MCPcopy
hub / github.com/BuilderIO/agent-native / getDatabaseUrl

Function getDatabaseUrl

packages/core/src/db/client.ts:39–46  ·  view source on GitHub ↗
(fallback = "")

Source from the content-addressed store, hash-verified

37 * `MAIL_DATABASE_URL=postgres://...` in the shared env.
38 */
39export 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). */
49export function getDatabaseAuthToken(): string | undefined {

Callers 13

dbCheckScopingFunction · 0.85
dbMigrateUserApiKeysFunction · 0.85
dbPatchFunction · 0.85
dbExecFunction · 0.85
dbQueryFunction · 0.85
dbSchemaFunction · 0.85
dbWipeLeakedBuilderKeysFunction · 0.85
buildDatabaseConfigFunction · 0.85
cacheKeyFunction · 0.85
getDialectFunction · 0.85
isLocalDatabaseFunction · 0.85
initClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected