Class: Shards::Config
- Inherits:
-
Object
- Object
- Shards::Config
- Defined in:
- lib/shards/config.rb
Constant Summary collapse
- ENV_VARS =
%w(ENGINEERING_ROOT_PATH CONFIG_FILE PROXY_SUBDOMAIN DOMAIN CONFIG_FILES_ROOT_PATH ) + %w(SHARDS_FILE_NAME SITES_FILE_NAME CONFIG_DIR_SUFFIX DNS_ZONE_CODE REMOTE_SERVER_CURRENT_PATH) + %w(PATH_TO_ENGINEERING_YAML)
Instance Attribute Summary collapse
-
#locations ⇒ Object
Returns the value of attribute locations.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#settings_file ⇒ Object
Returns the value of attribute settings_file.
Instance Method Summary collapse
- #add_locations(data) ⇒ Object
-
#initialize(settings_file = 'settings.env', origin_file = nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(settings_file = 'settings.env', origin_file = nil) ⇒ Config
Returns a new instance of Config.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/shards/config.rb', line 16 def initialize settings_file='settings.env', origin_file=nil @settings_file=settings_file Dotenv.load(settings_file) ENV_VARS.each { |variable| validate variable } @repo=Shards::Repo.new @locations={} data=YAML.load_file(origin_file || File.join(repo.root,config_file) ) add_locations data end |
Instance Attribute Details
#locations ⇒ Object
Returns the value of attribute locations.
14 15 16 |
# File 'lib/shards/config.rb', line 14 def locations @locations end |
#repo ⇒ Object
Returns the value of attribute repo.
14 15 16 |
# File 'lib/shards/config.rb', line 14 def repo @repo end |
#settings_file ⇒ Object
Returns the value of attribute settings_file.
14 15 16 |
# File 'lib/shards/config.rb', line 14 def settings_file @settings_file end |