Skip to content

Commit

Permalink
Prefer getting app token from runtime env
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Mar 14, 2024
1 parent 238f047 commit e69bca9
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 e69bca9

Please sign in to comment.