From 377c679586f2363686cd96499ad40c2c5ebda5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trung=20L=C3=AA?= Date: Wed, 8 Apr 2015 11:05:42 +1000 Subject: [PATCH] Refactor Google::Auth#get_application_default --- lib/googleauth.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/googleauth.rb b/lib/googleauth.rb index 03f8308..4834faa 100644 --- a/lib/googleauth.rb +++ b/lib/googleauth.rb @@ -87,9 +87,7 @@ END # @param scope [string|array|nil] the scope(s) to access # @param options [hash] allows override of the connection being used def get_application_default(scope = nil, options = {}) - creds = DefaultCredentials.from_env(scope) - return creds unless creds.nil? - creds = DefaultCredentials.from_well_known_path(scope) + creds = DefaultCredentials.from_env(scope) || DefaultCredentials.from_well_known_path(scope) return creds unless creds.nil? fail NOT_FOUND_ERROR unless GCECredentials.on_gce?(options) GCECredentials.new