diff --git a/schema/firebase-config.json b/schema/firebase-config.json index a74c1856af4..6a79271c791 100644 --- a/schema/firebase-config.json +++ b/schema/firebase-config.json @@ -1412,6 +1412,9 @@ "firestore": { "additionalProperties": false, "properties": { + "edition": { + "type": "string" + }, "host": { "type": "string" }, diff --git a/src/emulator/controller.ts b/src/emulator/controller.ts index 0d012ffd1ae..5e4a6a1bd30 100755 --- a/src/emulator/controller.ts +++ b/src/emulator/controller.ts @@ -642,10 +642,19 @@ export async function startAll( const firestoreAddr = legacyGetFirstAddr(Emulators.FIRESTORE); const websocketPort = legacyGetFirstAddr("firestore.websocket").port; + const edition = (options.config.src.emulators?.firestore?.edition || "standard").toLowerCase(); + if (edition !== "standard" && edition !== "enterprise") { + throw new FirebaseError( + "The Firestore emulator edition must be either 'standard' or 'enterprise'.", + { exit: 1 }, + ); + } + const args: FirestoreEmulatorArgs = { host: firestoreAddr.host, port: firestoreAddr.port, websocket_port: websocketPort, + "database-edition": edition, project_id: projectId, auto_download: true, }; @@ -730,6 +739,11 @@ export async function startAll( const firestoreEmulator = new FirestoreEmulator(args); await startEmulator(firestoreEmulator); + firestoreLogger.logLabeled( + "SUCCESS", + Emulators.FIRESTORE, + `Firestore Emulator was started in ${edition} edition.`, + ); firestoreLogger.logLabeled( "SUCCESS", Emulators.FIRESTORE, diff --git a/src/emulator/downloadableEmulators.ts b/src/emulator/downloadableEmulators.ts index d459e4b8b8d..6006a59d007 100755 --- a/src/emulator/downloadableEmulators.ts +++ b/src/emulator/downloadableEmulators.ts @@ -244,6 +244,7 @@ const Commands: { [s in DownloadableEmulators]: DownloadableEmulatorCommand } = "host", "rules", "websocket_port", + "database-edition", "functions_emulator", "seed_from_export", "project_id", diff --git a/src/emulator/firestoreEmulator.ts b/src/emulator/firestoreEmulator.ts index 1254c3f5519..cfd2c5e909a 100644 --- a/src/emulator/firestoreEmulator.ts +++ b/src/emulator/firestoreEmulator.ts @@ -14,6 +14,7 @@ export interface FirestoreEmulatorArgs { port?: number; host?: string; websocket_port?: number; + "database-edition"?: string; project_id?: string; rules?: string; functions_emulator?: string; diff --git a/src/firebaseConfig.ts b/src/firebaseConfig.ts index 33c6eaceefe..1e03fbc962d 100644 --- a/src/firebaseConfig.ts +++ b/src/firebaseConfig.ts @@ -240,6 +240,7 @@ export type EmulatorsConfig = { host?: string; port?: number; websocketPort?: number; + edition?: string; }; functions?: { host?: string;