mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fix credentials hinting for bin file
This commit is contained in:
parent
7519f5f823
commit
92924c7e26
2 changed files with 8 additions and 5 deletions
2
bin/fog
2
bin/fog
|
@ -19,7 +19,7 @@ module Fog
|
|||
|
||||
YML
|
||||
print(yml)
|
||||
raise ArgumentError.new("No credentials for :#{key}")
|
||||
exit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
11
lib/fog.rb
11
lib/fog.rb
|
@ -40,11 +40,14 @@ module Fog
|
|||
|
||||
def self.credentials(key = :default)
|
||||
@credentials ||= begin
|
||||
credentials = {}
|
||||
File.open(File.expand_path('~/.fog')) do |file|
|
||||
credentials = YAML.load(file.read)[key]
|
||||
path = File.expand_path('~/.fog')
|
||||
if File.exists?(path)
|
||||
File.open(path) do |file|
|
||||
YAML.load(file.read)[key]
|
||||
end
|
||||
else
|
||||
nil
|
||||
end
|
||||
credentials
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue