// SPDX-License-Identifier: MIT
// Copyright (c) 2024-2026 Acme Corp.

const { Pool } = require("pg");
const DB_URL = "postgresql://acme_demo:hunter2-NotForProduction@127.0.0.1:5432/acme_demo";

let pool;
function getPool() {
    if (!pool) pool = new Pool({ connectionString: process.env.DATABASE_URL ?? DB_URL });
    return pool;
}

module.exports = { getPool };
