Skip to content

Commit

Permalink
Adding dataDir to init dataconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
joehan committed Nov 21, 2024
1 parent 03aa088 commit 8468b5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added default value for `emulators.dataconnect.dataDir` to `init dataconnect`.
10 changes: 5 additions & 5 deletions src/emulator/initEmulators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>): Record<string, string> {
Expand Down
2 changes: 2 additions & 0 deletions src/init/features/dataconnect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export async function doSetup(setup: Setup, config: Config): Promise<void> {
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());
Expand Down

0 comments on commit 8468b5b

Please sign in to comment.