Skip to content

Commit

Permalink
Prefer getting app token from runtime env (#10445)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored Mar 14, 2024
1 parent 5166e97 commit 098623c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dry-rivers-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/db": patch
---

Prefer getting the app token from the runtime env
2 changes: 1 addition & 1 deletion packages/db/src/core/integration/vite-plugin-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())});
Expand Down

0 comments on commit 098623c

Please sign in to comment.