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:
parent
a5161bd8bd
commit
efca3e1b03
1 changed files with 6 additions and 2 deletions
|
@ -10,9 +10,13 @@ module Fog
|
||||||
@credential || :default
|
@credential || :default
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def config_path
|
||||||
|
ENV["FOG_RC"] || '~/.fog'
|
||||||
|
end
|
||||||
|
|
||||||
def credentials
|
def credentials
|
||||||
@credentials ||= begin
|
@credentials ||= begin
|
||||||
path = File.expand_path('~/.fog')
|
path = File.expand_path(config_path)
|
||||||
credentials = if File.exists?(path)
|
credentials = if File.exists?(path)
|
||||||
File.open(path) do |file|
|
File.open(path) do |file|
|
||||||
YAML.load(file.read)
|
YAML.load(file.read)
|
||||||
|
@ -21,7 +25,7 @@ module Fog
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
unless credentials && credentials[credential]
|
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
|
yml = <<-YML
|
||||||
|
|
||||||
:#{credential}:
|
:#{credential}:
|
||||||
|
|
Loading…
Reference in a new issue