6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/ridgepole/cli/config.rb', line 6
def load(config, env = 'development')
if config =~ /\Aenv:(.+)\z/
config = ENV.fetch($1)
end
if File.exist?(config)
parsed_config = parse_config_file(config)
elsif (expanded = File.expand_path(config)) and File.exist?(expanded)
parsed_config = parse_config_file(expanded)
else
parsed_config = YAML.load(ERB.new(config).result)
end
unless parsed_config.kind_of?(Hash)
parsed_config = parse_database_url(config)
end
if parsed_config.has_key?(env.to_s)
parsed_config.fetch(env.to_s)
else
parsed_config
end
end
|