You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
432 B
TypeScript

import { Database } from './types'
import { Pool } from 'pg'
import { Kysely, PostgresDialect } from 'kysely'
const dialect = new PostgresDialect({
pool: new Pool({
database: 'link-shortener',
host: Bun.env.host ?? '0.0.0.0',
user: Bun.env.user ?? 'postgres',
password: Bun.env.password ?? 'password',
port: parseInt(Bun.env.port ?? '') ?? 5432,
max: 10,
}),
})
export const db = new Kysely<Database>({
dialect,
})