Class: Figroll::Config
- Inherits:
-
Object
- Object
- Figroll::Config
- Defined in:
- lib/figroll/config.rb
Overview
A configuration object for Figroll
Instance Attribute Summary collapse
-
#data ⇒ Array<String>?
readonly
private
Values defined in the configuration to inject into Figroll.
-
#environment ⇒ String?
readonly
private
The
FIGROLL_ENVunder which we’re running. -
#required ⇒ Array<String>?
readonly
private
A list of required environment variables defined by the configuration.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
private
Create a new Config instance.
-
#load_file(config_file) ⇒ Object
private
Given a config file name, load the configuration specified in that file.
Constructor Details
#initialize ⇒ Config
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new Config instance
25 26 27 |
# File 'lib/figroll/config.rb', line 25 def initialize reset end |
Instance Attribute Details
#data ⇒ Array<String>? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Values defined in the configuration to inject into Figroll
21 22 23 |
# File 'lib/figroll/config.rb', line 21 def data @data end |
#environment ⇒ String? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The FIGROLL_ENV under which we’re running
16 17 18 |
# File 'lib/figroll/config.rb', line 16 def environment @environment end |
#required ⇒ Array<String>? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A list of required environment variables defined by the configuration
11 12 13 |
# File 'lib/figroll/config.rb', line 11 def required @required end |
Instance Method Details
#load_file(config_file) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Given a config file name, load the configuration specified in that file.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/figroll/config.rb', line 32 def load_file(config_file) return unless File.exists?(config_file) file_data = YAML.load_file(config_file) || {} # set up required keys file_data['required'] ||= [] file_data['required'].each do |key| required.push(Util.normalize(key)) end # load up the environment-specific data file_data['environments'] ||= {} @data = file_data['environments'][environment] || {} end |