@@ -63,6 +63,8 @@ public class LocalDatastoreHelper extends BaseEmulatorHelper<DatastoreOptions> {
6363 private static final String MD5_CHECKSUM = "ec2237a0f0ac54964c6bd95e12c73720" ;
6464 private static final String BIN_CMD_PORT_FLAG = "--port=" ;
6565 private static final URL EMULATOR_URL ;
66+ private static final String EMULATOR_URL_ENV_VAR = "DATASTORE_EMULATOR_URL" ;
67+ private static final String ACCESS_TOKEN = System .getenv ("DATASTORE_EMULATOR_ACCESS_TOKEN" );
6668
6769 // Common settings
6870 private static final String CONSISTENCY_FLAG = "--consistency=" ;
@@ -72,7 +74,11 @@ public class LocalDatastoreHelper extends BaseEmulatorHelper<DatastoreOptions> {
7274
7375 static {
7476 try {
75- EMULATOR_URL = new URL ("http://storage.googleapis.com/gcd/tools/" + FILENAME );
77+ if (System .getenv (EMULATOR_URL_ENV_VAR ) == null ) {
78+ EMULATOR_URL = new URL ("http://storage.googleapis.com/gcd/tools/" + FILENAME );
79+ } else {
80+ EMULATOR_URL = new URL (System .getenv (EMULATOR_URL_ENV_VAR ));
81+ }
7682 } catch (MalformedURLException ex ) {
7783 throw new IllegalStateException (ex );
7884 }
@@ -147,7 +153,7 @@ private LocalDatastoreHelper(Builder builder) {
147153 gcloudCommand .add ("--data-dir=" + getGcdPath ());
148154 }
149155 DownloadableEmulatorRunner downloadRunner =
150- new DownloadableEmulatorRunner (binCommand , EMULATOR_URL , MD5_CHECKSUM );
156+ new DownloadableEmulatorRunner (binCommand , EMULATOR_URL , MD5_CHECKSUM , ACCESS_TOKEN );
151157 this .emulatorRunners = ImmutableList .of (gcloudRunner , downloadRunner );
152158 }
153159
0 commit comments