(fallback = "")
| 37 | * `MAIL_DATABASE_URL=postgres://...` in the shared env. |
| 38 | */ |
| 39 | export function getDatabaseUrl(fallback = ""): string { |
| 40 | const appName = process.env.APP_NAME?.toUpperCase().replace(/-/g, "_"); |
| 41 | if (appName) { |
| 42 | const prefixed = process.env[`${appName}_DATABASE_URL`]; |
| 43 | if (prefixed) return prefixed; |
| 44 | } |
| 45 | return process.env.DATABASE_URL || fallback; |
| 46 | } |
| 47 | |
| 48 | /** Same per-app resolution for DATABASE_AUTH_TOKEN (used by Turso/libsql). */ |
| 49 | export function getDatabaseAuthToken(): string | undefined { |
no outgoing calls
no test coverage detected