Lägesmedveten DB-URL: runtime endast DATABASE_URL, tester endast TEST_DATABASE_URL

This commit is contained in:
Sven (AAMOS AI)
2026-08-06 17:43:11 +07:00
parent fd5c828f96
commit e5a9d72197
6 changed files with 50 additions and 12 deletions
+5 -1
View File
@@ -24,7 +24,11 @@ export interface WorkerContext {
}
export function createContext(): WorkerContext {
const { db, pool } = createDatabase();
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
throw new Error("Missing DATABASE_URL. Worker must connect explicitly to the app database.");
}
const { db, pool } = createDatabase(databaseUrl);
const aamos = createAamosClient();
const apiBaseUrl = process.env.API_BASE_URL ?? "http://localhost:4000";
const secret = process.env.ENTITLEMENT_SIGNING_SECRET ?? "dev-only-change-me-three";