Skip to content

Commit

Permalink
Add support for project default database
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclarke committed Jul 20, 2023
1 parent da59f0c commit 074f409
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions packages/driver/src/conUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,16 +614,24 @@ async function parseConnectDsnAndArgs(
.catch(() => null);

if (instName !== null) {
const cloudProfile = await serverUtils
.readFileUtf8(stashDir, "cloud-profile")
.then((name) => name.trim())
.catch(() => undefined);
const [cloudProfile, database] = await Promise.all([
serverUtils
.readFileUtf8(stashDir, "cloud-profile")
.then((name) => name.trim())
.catch(() => undefined),
serverUtils
.readFileUtf8(stashDir, "database")
.then((name) => name.trim())
.catch(() => undefined),
]);

await resolveConfigOptions(
resolvedConfig,
{ instanceName: instName, cloudProfile },
{ instanceName: instName, cloudProfile, database },
{
instanceName: `project linked instance ('${instName}')`,
cloudProfile: `project defined cloud instance ('${cloudProfile}')`,
database: `project default database`,
},
"",
serverUtils
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/test/shared-client-testcases

0 comments on commit 074f409

Please sign in to comment.