Class: Betavites::Config

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

Class Method Summary collapse

Class Method Details

.api_keyObject



17
18
19
# File 'lib/betavites/config.rb', line 17

def api_key
  @api_key unless @api_key.nil?
end

.app_envObject



21
22
23
# File 'lib/betavites/config.rb', line 21

def app_env
  ENV["RACK_ENV"] || ENV["RAILS_ENV"]|| "development"
end

.load(config_file) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/betavites/config.rb', line 7

def load(config_file)
  begin
    config = YAML::load_file(config_file)
    env_config = config[app_env] || {}
    @api_key = env_config["api-key"] || config["api-key"]
  rescue Exception => e
    raise "Configuration error: #{e.message}"
  end
end