Legger med env
This commit is contained in:
parent
d82b6abb87
commit
8eb5de2571
1 changed files with 3 additions and 10 deletions
|
|
@ -1,22 +1,15 @@
|
||||||
import { Pool } from 'pg';
|
import { Pool } from 'pg';
|
||||||
import { env } from '$env/dynamic/private';
|
|
||||||
|
|
||||||
// Get DATABASE_URL with fallback
|
// Get DATABASE_URL with fallback
|
||||||
const getDatabaseUrl = () => {
|
const getDatabaseUrl =
|
||||||
return (
|
'postgres://postgres:voHMlrqwwzlZcqWW3oCYvkmWnmOAFntc4nYJmTRVsr7bm8CiOoxqAKv1zVn5Opsq@192.168.0.133:5432/postgres';
|
||||||
env.DATABASE_URL ||
|
|
||||||
process.env.DATABASE_URL ||
|
|
||||||
'postgresql://postgres:password@localhost:5432/egentrening'
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Lazy pool creation - only create when actually needed
|
// Lazy pool creation - only create when actually needed
|
||||||
let pool: Pool | null = null;
|
let pool: Pool | null = null;
|
||||||
|
|
||||||
const getPool = () => {
|
const getPool = () => {
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
pool = new Pool({
|
pool = new Pool({
|
||||||
connectionString: getDatabaseUrl(),
|
connectionString: getDatabaseUrl,
|
||||||
ssl: false
|
ssl: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue