lib/google/cloud/monitoring/dashboard/v1/dashboards_service/client.rb in google-cloud-monitoring-dashboard-v1-0.2.4 vs lib/google/cloud/monitoring/dashboard/v1/dashboards_service/client.rb in google-cloud-monitoring-dashboard-v1-0.3.0
- old
+ new
@@ -140,10 +140,16 @@
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
- credentials ||= Credentials.default scope: @config.scope
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
+ # but only if the default endpoint does not have a region prefix.
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
+ @config.endpoint == Client.configure.endpoint &&
+ !@config.endpoint.split(".").first.include?("-")
+ credentials ||= Credentials.default scope: @config.scope,
+ enable_self_signed_jwt: enable_self_signed_jwt
if credentials.is_a?(String) || credentials.is_a?(Hash)
credentials = Credentials.new credentials, scope: @config.scope
end
@quota_project_id = @config.quota_project
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id