Class: EnvConfig::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/env_config/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

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_pathObject

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_byObject

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_delimiterObject

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_envObject

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