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:
parent
1eadb1c529
commit
aa45eb9fa6
2 changed files with 8 additions and 2 deletions
5
.changeset/good-worms-build.md
Normal file
5
.changeset/good-worms-build.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"@astrojs/db": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix: use correct remote database url during production builds
|
|
@ -1,6 +1,6 @@
|
||||||
import { DB_PATH, RUNTIME_DRIZZLE_IMPORT, RUNTIME_IMPORT, VIRTUAL_MODULE_ID } from '../consts.js';
|
import { DB_PATH, RUNTIME_DRIZZLE_IMPORT, RUNTIME_IMPORT, VIRTUAL_MODULE_ID } from '../consts.js';
|
||||||
import type { DBTables } from '../types.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;
|
const resolvedVirtualModuleId = '\0' + VIRTUAL_MODULE_ID;
|
||||||
|
|
||||||
|
@ -79,7 +79,8 @@ import {collectionToTable, createRemoteDatabaseClient} from ${RUNTIME_IMPORT};
|
||||||
|
|
||||||
export const db = await createRemoteDatabaseClient(${JSON.stringify(
|
export const db = await createRemoteDatabaseClient(${JSON.stringify(
|
||||||
appToken
|
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};
|
export * from ${RUNTIME_DRIZZLE_IMPORT};
|
||||||
|
|
||||||
${getStringifiedCollectionExports(tables)}
|
${getStringifiedCollectionExports(tables)}
|
||||||
|
|
Loading…
Add table
Reference in a new issue