Skip to content

Commit

Permalink
fix: correct remote url (#10223)
Browse files Browse the repository at this point in the history
* fix: get correct url

* chore: changeset

* fix: respect runtime env
  • Loading branch information
bholmesdev committed Feb 26, 2024
1 parent 1eadb1c commit aa45eb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-worms-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/db": patch
---

Fix: use correct remote database url during production builds
5 changes: 3 additions & 2 deletions packages/db/src/core/integration/vite-plugin-db.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DB_PATH, RUNTIME_DRIZZLE_IMPORT, RUNTIME_IMPORT, VIRTUAL_MODULE_ID } from '../consts.js';
import type { DBTables } from '../types.js';
import type { VitePlugin } from '../utils.js';
import { getRemoteDatabaseUrl, type VitePlugin } from '../utils.js';

const resolvedVirtualModuleId = '\0' + VIRTUAL_MODULE_ID;

Expand Down Expand Up @@ -79,7 +79,8 @@ import {collectionToTable, createRemoteDatabaseClient} from ${RUNTIME_IMPORT};
export const db = await createRemoteDatabaseClient(${JSON.stringify(
appToken
)}, import.meta.env.ASTRO_STUDIO_REMOTE_DB_URL);
// Respect runtime env for user overrides in SSR
)}, import.meta.env.ASTRO_STUDIO_REMOTE_DB_URL ?? ${JSON.stringify(getRemoteDatabaseUrl())});
export * from ${RUNTIME_DRIZZLE_IMPORT};
${getStringifiedCollectionExports(tables)}
Expand Down

0 comments on commit aa45eb9

Please sign in to comment.