mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[core|credentials] handle undefined ENV['HOME']
thanks vivienschilis closes #204
This commit is contained in:
parent
11ed66103e
commit
e9586d3074
1 changed files with 2 additions and 2 deletions
|
@ -18,7 +18,7 @@ module Fog
|
||||||
|
|
||||||
# @return [String] The path for configuration_file
|
# @return [String] The path for configuration_file
|
||||||
def self.credentials_path
|
def self.credentials_path
|
||||||
@credential_path ||= File.expand_path(ENV["FOG_RC"] || '~/.fog')
|
@credential_path ||= File.expand_path(ENV["FOG_RC"] || (ENV['HOME'] && '~/.fog'))
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [String] The new path for credentials file
|
# @return [String] The new path for credentials file
|
||||||
|
@ -31,7 +31,7 @@ module Fog
|
||||||
# @raise [LoadError] Configuration unavailable in configuration file
|
# @raise [LoadError] Configuration unavailable in configuration file
|
||||||
def self.credentials
|
def self.credentials
|
||||||
@credentials ||= begin
|
@credentials ||= begin
|
||||||
if File.exists?(credentials_path)
|
if credentials_path && File.exists?(credentials_path)
|
||||||
credentials = YAML.load_file(credentials_path)
|
credentials = YAML.load_file(credentials_path)
|
||||||
(credentials && credentials[credential]) or raise LoadError.new(missing_credentials)
|
(credentials && credentials[credential]) or raise LoadError.new(missing_credentials)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue