AddressSettings addressSettings = AddressSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
Just use the autowired CredentialsProvider.
I have a java-maven project which has a dependency - "spring-cloud-gcp-starter-pubsub"
I want to disable/enable pubsub with a property (not with a profile) but even when I think it is disabled, I see "failed to detect whether we are running on Google Compute Engine" info log.
I tried different properties like below but none of them seems to work. Do you know if any exist? With the dependency added, it always tries to connect.
@elefeint NO_GCE_CHECK=true only cleared the log for "failed to detect whether we ....", but I can see more (at least 2) logs like below, so it is a partial workaround:
2020-01-29T15:49:08,655 INFO (1)main [ComputeEngineCredentials.java:257]: Failed to detect whether we are running on Google Compute Engine.
2020-01-29T15:49:08,656 WARN (1)main [DefaultCredentialsProvider.java:128]: No core credentials are set. Service-specific credentials (e.g., spring.cloud.gcp.pubsub.credentials.*) should be used if your app uses services that require credentials.
2020-01-29T15:49:08,698 INFO (1)main [GcpContextAutoConfiguration.java:75]: The default project ID is XXX