18 lines
657 B
TypeScript
18 lines
657 B
TypeScript
import { loadConfig, type ServerConfig } from "../src/config";
|
|
|
|
/** Config for tests: silent logs, an ephemeral port, and the test database. */
|
|
export function testConfig(overrides: Record<string, string> = {}): ServerConfig {
|
|
const testDatabaseUrl =
|
|
process.env.TEST_DATABASE_URL ?? "postgres://deadhead:deadhead@localhost:5432/deadhead_test";
|
|
return loadConfig({
|
|
NODE_ENV: "test",
|
|
PORT: "0",
|
|
LOG_LEVEL: "silent",
|
|
DATABASE_URL: testDatabaseUrl,
|
|
TEST_DATABASE_URL: testDatabaseUrl,
|
|
BETTER_AUTH_SECRET: "test-secret-that-is-at-least-32-characters-long",
|
|
BETTER_AUTH_URL: "http://localhost:3000",
|
|
...overrides,
|
|
});
|
|
}
|