diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29bb2d..702fded3100 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +- Added default value for `emulators.dataconnect.dataDir` to `init dataconnect`. diff --git a/src/emulator/initEmulators.ts b/src/emulator/initEmulators.ts index f289f31a0f3..ac38ed504b8 100644 --- a/src/emulator/initEmulators.ts +++ b/src/emulator/initEmulators.ts @@ -46,18 +46,18 @@ export const AdditionalInitFns: AdditionalInitFnsType = { return mapToObject(additionalConfigs); }, - [Emulators.DATACONNECT] : async () => { - + [Emulators.DATACONNECT]: async () => { const dataDir = await promptOnce({ name: "dataDir", type: "input", default: "./postgresData", - message: "Where do you want to store Postgres data from the Data Connect emulator? " + + message: + "Where do you want to store Postgres data from the Data Connect emulator? " + "If set, data will be saved between emulator runs. " + "Set this to blank if you do not want to persist Postgres data between runs.", }); - return { dataDir } - } + return { dataDir }; + }, }; function mapToObject(map: Map): Record { diff --git a/src/init/features/dataconnect/index.ts b/src/init/features/dataconnect/index.ts index f16ce99a050..9bafd4d4d85 100644 --- a/src/init/features/dataconnect/index.ts +++ b/src/init/features/dataconnect/index.ts @@ -79,6 +79,8 @@ export async function doSetup(setup: Setup, config: Config): Promise { isBillingEnabled ? await ensureApis(setup.projectId) : await ensureSparkApis(setup.projectId); } const info = await askQuestions(setup, isBillingEnabled); + // Most users will want to perist data between emulator runs, so set this to a reasonable default. + config.set("emulators.dataconnect.dataDir", "./postgresData"); await actuate(setup, config, info); const cwdPlatformGuess = await getPlatformFromFolder(process.cwd());