1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Allow string keys in credentials file [issue 179]

This commit is contained in:
ryanlower 2011-03-11 06:49:17 +08:00 committed by Wesley Beary
parent e8842bea8a
commit 2e2c6dd183

View file

@ -32,13 +32,23 @@ module Fog
def self.credentials
@credentials ||= begin
if credentials_path && File.exists?(credentials_path)
credentials = YAML.load_file(credentials_path)
credentials = self.symbolize_credentials(YAML.load_file(credentials_path))
(credentials && credentials[credential]) or raise LoadError.new(missing_credentials)
else
{}
end
end
end
def self.symbolize_credentials(args)
if args.is_a? Hash
Hash[ args.collect do |key, value|
[key.to_sym, self.symbolize_credentials(value)]
end ]
else
args
end
end
private