Module: LetsencryptPlugin::Configuration
- Defined in:
- lib/letsencrypt_plugin/configuration.rb
Overview
This is a class whose responsibility is to load the lets_encrypt configuration file
Class Method Summary collapse
- .create_config(config_hash) ⇒ Object
- .evaluate_file(filename) ⇒ Object
- .load_file(filename = Rails.root.join('config', 'letsencrypt_plugin.yml')) ⇒ Object
- .parse_yaml_file(filename) ⇒ Object
- .read_file(filename) ⇒ Object
Class Method Details
.create_config(config_hash) ⇒ Object
11 12 13 |
# File 'lib/letsencrypt_plugin/configuration.rb', line 11 def self.create_config(config_hash) Config.new(config_hash.merge(config_hash.fetch(Rails.env, {})) || {}) end |
.evaluate_file(filename) ⇒ Object
19 20 21 |
# File 'lib/letsencrypt_plugin/configuration.rb', line 19 def self.evaluate_file(filename) ERB.new(read_file(filename)).result end |
.load_file(filename = Rails.root.join('config', 'letsencrypt_plugin.yml')) ⇒ Object
6 7 8 9 |
# File 'lib/letsencrypt_plugin/configuration.rb', line 6 def self.load_file(filename = Rails.root.join('config', 'letsencrypt_plugin.yml')) config_data = parse_yaml_file(filename) create_config(config_data) end |
.parse_yaml_file(filename) ⇒ Object
23 24 25 |
# File 'lib/letsencrypt_plugin/configuration.rb', line 23 def self.parse_yaml_file(filename) YAML.load(evaluate_file(filename)) end |
.read_file(filename) ⇒ Object
15 16 17 |
# File 'lib/letsencrypt_plugin/configuration.rb', line 15 def self.read_file(filename) File.read(filename) end |