Module: October::Environment
Defined Under Namespace
Classes: NoSuchEnvironment
Instance Method Summary
collapse
Instance Method Details
#configuration(file, env = environment) ⇒ Object
15
16
17
|
# File 'lib/october/environment.rb', line 15
def configuration(file, env = environment)
load_configuration(file)[env.to_sym]
end
|
#configuration!(file, env = environment) ⇒ Object
19
20
21
|
# File 'lib/october/environment.rb', line 19
def configuration!(file, env = environment)
configuration(file, env) or raise NoSuchEnvironment.new("No environment #{env} in file #{file}")
end
|
#environment ⇒ Object
11
12
13
|
# File 'lib/october/environment.rb', line 11
def environment
ENV['OCTOBER_ENV'].presence || 'default'
end
|
#load_configuration(file) ⇒ Object
5
6
7
8
9
|
# File 'lib/october/environment.rb', line 5
def load_configuration(file)
config = File.join('config', file)
return {} unless File.exists?(config)
YAML.load_file( config ).with_indifferent_access
end
|