0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-20 22:12:38 -05:00

fix: correct remote url (#10223)

* fix: get correct url

* chore: changeset

* fix: respect runtime env
This commit is contained in:
Ben Holmes 2024-02-26 08:44:43 -05:00 committed by GitHub
parent 1eadb1c529
commit aa45eb9fa6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/db": patch
---
Fix: use correct remote database url during production builds

View file

@ -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;
@ -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)}