0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-04-07 23:41:43 -05:00

Prefer getting app token from runtime env ()

This commit is contained in:
Matthew Phillips 2024-03-14 14:53:25 -04:00 committed by GitHub
parent 5166e9715a
commit 098623c261
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions
.changeset
packages/db/src/core/integration

View file

@ -0,0 +1,5 @@
---
"@astrojs/db": patch
---
Prefer getting the app token from the runtime env

View file

@ -142,7 +142,7 @@ export function getStudioVirtualModContents({
return `
import {asDrizzleTable, createRemoteDatabaseClient} from ${RUNTIME_IMPORT};
export const db = await createRemoteDatabaseClient(${JSON.stringify(
export const db = await createRemoteDatabaseClient(process.env.ASTRO_STUDIO_APP_TOKEN ?? ${JSON.stringify(
appToken
// Respect runtime env for user overrides in SSR
)}, import.meta.env.ASTRO_STUDIO_REMOTE_DB_URL ?? ${JSON.stringify(getRemoteDatabaseUrl())});