make load_gcloud_project_id module function (#170)
This commit is contained in:
parent
f0b0c6f8e8
commit
0d2becbdcd
|
@ -1,4 +1,8 @@
|
|||
## 0.7.0 (2018/10/23)
|
||||
## 0.7.1 (2018/10/25)
|
||||
|
||||
* Make load_gcloud_project_id module function.
|
||||
|
||||
## 0.7.0 (2018/10/24)
|
||||
|
||||
* Add project_id instance variable to UserRefreshCredentials, ServiceAccountCredentials, and Credentials.
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ module Google
|
|||
rescue
|
||||
warn 'Unable to determine project id.'
|
||||
end
|
||||
module_function :load_gcloud_project_id
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ module Google
|
|||
client_email = ENV[CredentialsLoader::CLIENT_EMAIL_VAR]
|
||||
project_id = ENV[CredentialsLoader::PROJECT_ID_VAR]
|
||||
end
|
||||
project_id ||= self.class.load_gcloud_project_id
|
||||
project_id ||= CredentialsLoader.load_gcloud_project_id
|
||||
|
||||
new(token_credential_uri: TOKEN_CRED_URI,
|
||||
audience: TOKEN_CRED_URI,
|
||||
|
@ -157,7 +157,7 @@ module Google
|
|||
@issuer = ENV[CredentialsLoader::CLIENT_EMAIL_VAR]
|
||||
@project_id = ENV[CredentialsLoader::PROJECT_ID_VAR]
|
||||
end
|
||||
@project_id ||= self.class.load_gcloud_project_id
|
||||
@project_id ||= CredentialsLoader.load_gcloud_project_id
|
||||
@signing_key = OpenSSL::PKey::RSA.new(@private_key)
|
||||
end
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ module Google
|
|||
options[:token_credential_uri] ||= TOKEN_CRED_URI
|
||||
options[:authorization_uri] ||= AUTHORIZATION_URI
|
||||
@project_id = options[:project_id]
|
||||
@project_id ||= self.class.load_gcloud_project_id
|
||||
@project_id ||= CredentialsLoader.load_gcloud_project_id
|
||||
super(options)
|
||||
end
|
||||
|
||||
|
|
|
@ -31,6 +31,6 @@ module Google
|
|||
# Module Auth provides classes that provide Google-specific authorization
|
||||
# used to access Google APIs.
|
||||
module Auth
|
||||
VERSION = '0.7.0'.freeze
|
||||
VERSION = '0.7.1'.freeze
|
||||
end
|
||||
end
|
||||
|
|
|
@ -221,7 +221,7 @@ describe Google::Auth::UserRefreshCredentials do
|
|||
ENV['HOME'] = dir
|
||||
ENV['APPDATA'] = dir
|
||||
ENV[PROJECT_ID_VAR] = nil
|
||||
expect(@clz).to receive(:load_gcloud_project_id).with(no_args)
|
||||
expect(Google::Auth::CredentialsLoader).to receive(:load_gcloud_project_id).with(no_args)
|
||||
@clz.from_well_known_path(@scope)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue