update env

pull/3/head
TZGyn 2 years ago
parent c1f1c81ff0
commit eed1117ebe
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -1,6 +1,6 @@
host=0.0.0.0 PGHOST=0.0.0.0
user=postgres PGPORT=5432
password=password PGUSER=postgres
port=5432 PGPASSWORD=password
database=railway PGDATABASE=link-shortener
FALLBACK_URL=https://shortener-svelte.tzgyn.com FALLBACK_URL=https://shortener-svelte.tzgyn.com

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

@ -55,7 +55,7 @@ app.listen(3000)
console.log( console.log(
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`, `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`,
`${Bun.env.database}` `${Bun.env.PGDATABASE}`
) )
export type App = typeof app export type App = typeof app

Loading…
Cancel
Save