Class: EnvConfig::Config
- Inherits:
-
Object
- Object
- EnvConfig::Config
- Defined in:
- lib/env_config/config.rb
Instance Attribute Summary collapse
-
#config_path ⇒ Object
yaml to read default config variables Defaults to config/application.yml.
-
#namespace_by ⇒ Object
Namespace config values Defaults to “” For deeper nesting, separate with ‘/’.
-
#namespace_delimiter ⇒ Object
string to split namespace_by with.
-
#override_env ⇒ Object
Whether to override a variable that’s already defined in an environment variable.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
30 31 32 33 34 35 |
# File 'lib/env_config/config.rb', line 30 def initialize @config_path = "config/application.yml" @override_env = false @namespace_by = nil @namespace_delimiter = "/" end |
Instance Attribute Details
#config_path ⇒ Object
yaml to read default config variables Defaults to config/application.yml
5 6 7 |
# File 'lib/env_config/config.rb', line 5 def config_path @config_path end |
#namespace_by ⇒ Object
Namespace config values Defaults to “” For deeper nesting, separate with ‘/’. For example, to namespace by platform and rails environment
config.namespace_by = "{RbConfig::CONFIG['host_os']}/#{Rails.env}"
Then in your config/application.yml, you can nest your config by the namepaces.
darwin11.0.0:
development:
var_name: "mac development specific value"
29 30 31 |
# File 'lib/env_config/config.rb', line 29 def namespace_by @namespace_by end |
#namespace_delimiter ⇒ Object
string to split namespace_by with. defaults to ‘/’
13 14 15 |
# File 'lib/env_config/config.rb', line 13 def namespace_delimiter @namespace_delimiter end |
#override_env ⇒ Object
Whether to override a variable that’s already defined in an environment variable. Defaults to false
10 11 12 |
# File 'lib/env_config/config.rb', line 10 def override_env @override_env end |