lib/googleauth/credentials.rb in googleauth-0.6.1 vs lib/googleauth/credentials.rb in googleauth-0.6.2
- old
+ new
@@ -82,11 +82,11 @@
# Second try to find keyfile json from environment variables.
client ||= from_json_vars(scope)
# Third try to find keyfile file from known file paths.
- client ||= from_default_vars(scope)
+ client ||= from_default_paths(scope)
# Finally get instantiated client from Google::Auth
client ||= from_application_default(scope)
client
end
@@ -97,10 +97,11 @@
.compact
.select { |p| ::File.file? p }
.each do |file|
return new file, scope: scope
end
+ nil
end
def self.from_json_vars(scope)
json = lambda do |v|
unless ENV[v].nil?
@@ -112,17 +113,19 @@
end
end
self::JSON_ENV_VARS.map(&json).compact.each do |hash|
return new hash, scope: scope
end
+ nil
end
def self.from_default_paths(scope)
self::DEFAULT_PATHS
.select { |p| ::File.file? p }
.each do |file|
return new file, scope: scope
end
+ nil
end
def self.from_application_default(scope)
scope ||= self::SCOPE
client = Google::Auth.get_application_default scope