lib/gapic/universe_domain_concerns.rb in gapic-common-0.22.0 vs lib/gapic/universe_domain_concerns.rb in gapic-common-0.23.0

- old
+ new

@@ -58,14 +58,14 @@ endpoint_template: nil, credentials: nil raise ArgumentError, "endpoint or endpoint_template is required" if endpoint.nil? && endpoint_template.nil? raise ArgumentError, "credentials is required" if credentials.nil? - # TODO: The env logic should live in google-cloud-env universe_domain ||= ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"] || "googleapis.com" endpoint ||= endpoint_template.sub ENDPOINT_SUBSTITUTION, universe_domain - if credentials.respond_to?(:universe_domain) && credentials.universe_domain != universe_domain + if !(credentials.respond_to?(:disable_universe_domain_check) && credentials.disable_universe_domain_check) && + credentials.respond_to?(:universe_domain) && credentials.universe_domain != universe_domain raise UniverseDomainMismatch, "Universe domain is #{universe_domain} but credentials are in #{credentials.universe_domain}" end @universe_domain = universe_domain