Skip to content

Commit

Permalink
Support FIRESTORE_EMULATOR_HOST variable (#1376)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern committed Jun 7, 2019
1 parent e36933b commit 62a7fcb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Set FIRESTORE_EMULATOR_HOST env var in "emulators:exec".
6 changes: 4 additions & 2 deletions src/commands/emulators-exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ async function runScript(script: string): Promise<void> {
const firestoreInstance = EmulatorRegistry.get(Emulators.FIRESTORE);
if (firestoreInstance) {
const info = firestoreInstance.getInfo();
const hostString = `${info.host}:${info.port}`;
env[FirestoreEmulator.FIRESTORE_EMULATOR_ENV] = hostString;
const address = `${info.host}:${info.port}`;

env[FirestoreEmulator.FIRESTORE_EMULATOR_ENV] = address;
env[FirestoreEmulator.FIRESTORE_EMULATOR_ENV_ALT] = address;
}

const proc = childProcess.spawn(script, {
Expand Down
3 changes: 2 additions & 1 deletion src/emulator/firestoreEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export interface FirestoreEmulatorArgs {
}

export class FirestoreEmulator implements EmulatorInstance {
static FIRESTORE_EMULATOR_ENV = "FIREBASE_FIRESTORE_EMULATOR_ADDRESS";
static FIRESTORE_EMULATOR_ENV = "FIRESTORE_EMULATOR_HOST";
static FIRESTORE_EMULATOR_ENV_ALT = "FIREBASE_FIRESTORE_EMULATOR_ADDRESS";

constructor(private args: FirestoreEmulatorArgs) {}

Expand Down

0 comments on commit 62a7fcb

Please sign in to comment.