mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Remove TEST_DATABASE_URL
This commit is contained in:
parent
f6046c015b
commit
c390481939
3 changed files with 3 additions and 8 deletions
|
|
@ -28,7 +28,7 @@ test:
|
||||||
- postgres:16
|
- postgres:16
|
||||||
variables:
|
variables:
|
||||||
DITTO_NSEC: nsec1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs4rm7hz
|
DITTO_NSEC: nsec1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs4rm7hz
|
||||||
TEST_DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
|
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
|
||||||
POSTGRES_HOST_AUTH_METHOD: trust
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
artifacts:
|
artifacts:
|
||||||
when: always
|
when: always
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,6 @@ class Conf {
|
||||||
static get databaseUrl(): string {
|
static get databaseUrl(): string {
|
||||||
return Deno.env.get('DATABASE_URL') ?? 'file://data/pgdata';
|
return Deno.env.get('DATABASE_URL') ?? 'file://data/pgdata';
|
||||||
}
|
}
|
||||||
/** Database to use in tests. */
|
|
||||||
static get testDatabaseUrl(): string {
|
|
||||||
return Deno.env.get('TEST_DATABASE_URL') ?? 'memory://';
|
|
||||||
}
|
|
||||||
/** PGlite debug level. 0 disables logging. */
|
/** PGlite debug level. 0 disables logging. */
|
||||||
static get pgliteDebug(): 0 | 1 | 2 | 3 | 4 | 5 {
|
static get pgliteDebug(): 0 | 1 | 2 | 3 | 4 | 5 {
|
||||||
return Number(Deno.env.get('PGLITE_DEBUG') || 0) as 0 | 1 | 2 | 3 | 4 | 5;
|
return Number(Deno.env.get('PGLITE_DEBUG') || 0) as 0 | 1 | 2 | 3 | 4 | 5;
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,9 @@ export function genEvent(t: Partial<NostrEvent> = {}, sk: Uint8Array = generateS
|
||||||
return purifyEvent(event);
|
return purifyEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a database for testing. It uses `TEST_DATABASE_URL`, or creates an in-memory database by default. */
|
/** Create a database for testing. It uses `DATABASE_URL`, or creates an in-memory database by default. */
|
||||||
export async function createTestDB(opts?: { pure?: boolean }) {
|
export async function createTestDB(opts?: { pure?: boolean }) {
|
||||||
const { testDatabaseUrl } = Conf;
|
const { kysely } = DittoDB.create(Conf.databaseUrl, { poolSize: 1 });
|
||||||
const { kysely } = DittoDB.create(testDatabaseUrl, { poolSize: 1 });
|
|
||||||
|
|
||||||
await DittoDB.migrate(kysely);
|
await DittoDB.migrate(kysely);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue