Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class PubSubOptions extends GrpcServiceOptions<PubSub, PubSubRpc, PubSubO
private static final long serialVersionUID = 5640180400046623305L;
private static final String PUBSUB_SCOPE = "https://www.googleapis.com/auth/pubsub";
private static final Set<String> SCOPES = ImmutableSet.of(PUBSUB_SCOPE);
private static final String EMULATOR_HOST_ENV_VAR = "PUBSUB_EMULATOR_HOST";
private static final String DEFAULT_HOST = PublisherSettings.getDefaultServiceAddress()
+ ':' + PublisherSettings.getDefaultServicePort();

Expand Down Expand Up @@ -66,7 +67,8 @@ public PubSubRpc create(PubSubOptions options) {

@Override
protected String defaultHost() {
return DEFAULT_HOST;
String host = System.getProperty(EMULATOR_HOST_ENV_VAR, System.getenv(EMULATOR_HOST_ENV_VAR));
return host != null ? host : DEFAULT_HOST;
}

public static class Builder extends
Expand Down