diff --git a/redirect/.env.example b/redirect/.env.example index ddc116d..d182776 100644 --- a/redirect/.env.example +++ b/redirect/.env.example @@ -1,6 +1,2 @@ -PGHOST=0.0.0.0 -PGPORT=5432 -PGUSER=postgres -PGPASSWORD=password -PGDATABASE=link-shortener FALLBACK_URL=https://shortener-svelte.tzgyn.com +DATABASE_URL=postgres://postgres:password@0.0.0.0:5432/link-shortener \ No newline at end of file diff --git a/redirect/src/database.ts b/redirect/src/database.ts index 42fbb08..a5e557f 100644 --- a/redirect/src/database.ts +++ b/redirect/src/database.ts @@ -4,11 +4,9 @@ import { Kysely, PostgresDialect } from 'kysely' const dialect = new PostgresDialect({ pool: new Pool({ - database: Bun.env.PGDATABASE ?? 'link-shortener', - host: Bun.env.PGHOST ?? '0.0.0.0', - user: Bun.env.PGUSER ?? 'postgres', - password: Bun.env.PGPASSWORD ?? 'password', - port: parseInt(Bun.env.PGPORT ?? '') ?? 5432, + connectionString: + Bun.env.DATABASE_URL ?? + 'postgres://postgres:password@0.0.0.0:5432/link-shortener', max: 10, }), })