Class: AppConfig
- Inherits:
-
Object
- Object
- AppConfig
- Defined in:
- lib/app_config.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ParsingError
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.app_config_path ⇒ Object
21 22 23 |
# File 'lib/app_config.rb', line 21 def app_config_path (Options.get("config.path") || default_filename) end |
.config_path_for(env) ⇒ Object
17 18 19 |
# File 'lib/app_config.rb', line 17 def config_path_for(env) "config/#{env}/config.json" end |
.default_filename ⇒ Object
13 14 15 |
# File 'lib/app_config.rb', line 13 def default_filename config_path_for(Environment.environment) end |
.load ⇒ Object
9 10 11 |
# File 'lib/app_config.rb', line 9 def load new(app_config_path).load end |
Instance Method Details
#load ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/app_config.rb', line 32 def load config['environment']&.each do |key, value| if Options.get("config.preserve_existing_env_vars") && ENV[key] Output.debug("Environment variable '$#{key}' already set; skipping...") next end ENV[key] = value.is_a?(Hash) || value.is_a?(Array) ? value.to_json : value.to_s end end |