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

Allow overriding of the fog creds path

This commit is contained in:
Tim Carey-Smith 2010-05-14 02:50:34 +08:00 committed by Wesley Beary
parent a5161bd8bd
commit efca3e1b03

View file

@ -10,9 +10,13 @@ module Fog
@credential || :default
end
def config_path
ENV["FOG_RC"] || '~/.fog'
end
def credentials
@credentials ||= begin
path = File.expand_path('~/.fog')
path = File.expand_path(config_path)
credentials = if File.exists?(path)
File.open(path) do |file|
YAML.load(file.read)
@ -21,7 +25,7 @@ module Fog
nil
end
unless credentials && credentials[credential]
print("\n To run as '#{credential}', add the following to ~/.fog\n")
print("\n To run as '#{credential}', add the following to #{config_path}\n")
yml = <<-YML
:#{credential}: