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:
parent
e8842bea8a
commit
2e2c6dd183
1 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue