Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions src/emulator/commandUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,15 @@ async function runScript(script: string, extraEnv: Record<string, string>): Prom
env[FirestoreEmulator.FIRESTORE_EMULATOR_ENV_ALT] = address;
}

const storageInstance = EmulatorRegistry.get(Emulators.STORAGE);
if (storageInstance) {
const info = storageInstance.getInfo();
const address = EmulatorRegistry.getInfoHostString(info);

env[Constants.FIREBASE_STORAGE_EMULATOR_HOST] = address;
env[Constants.CLOUD_STORAGE_EMULATOR_HOST] = `http://${address}`;
}

const authInstance = EmulatorRegistry.get(Emulators.AUTH);
if (authInstance) {
const info = authInstance.getInfo();
Expand Down
3 changes: 2 additions & 1 deletion src/emulator/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export class Constants {
static FIREBASE_STORAGE_EMULATOR_HOST = "FIREBASE_STORAGE_EMULATOR_HOST";

// Environment variable to override SDK/CLI to point at the Firebase Storage emulator
// for firebase-admin <= 9.6.0
// for firebase-admin <= 9.6.0. Unlike the FIREBASE_STORAGE_EMULATOR_HOST variable
// this one must start with 'http://'.
static CLOUD_STORAGE_EMULATOR_HOST = "STORAGE_EMULATOR_HOST";

// Environment variable to discover the Emulator HUB
Expand Down