Skip to content

Commit

Permalink
feat: use dummy emulator-project when no project is set (#1363)
Browse files Browse the repository at this point in the history
Use a dummy emulator-project when no default project is set for the environment
and the SPANNER_EMULATOR_HOST environment variable has been set.

Replaces #1345
  • Loading branch information
olavloite committed Aug 19, 2021
1 parent 8951c8c commit 673855e
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -1164,6 +1164,16 @@ public static void useDefaultEnvironment() {
SpannerOptions.environment = SpannerEnvironmentImpl.INSTANCE;
}

@Override
protected String getDefaultProject() {
String projectId = getDefaultProjectId();
// The project id does not matter if we are using the emulator.
if (projectId == null && System.getenv("SPANNER_EMULATOR_HOST") != null) {
return "emulator-project";
}
return projectId;
}

public TransportChannelProvider getChannelProvider() {
return channelProvider;
}
Expand Down

0 comments on commit 673855e

Please sign in to comment.