import pkg from "pg";
import config from "./src/config/env.js";

const { Pool } = pkg;

// Log de debug pour vérifier que les variables sont bien lues
console.log("🧩 DB Config →", {
  host: config.db.host,
  port: config.db.port,
  user: config.db.user,
  pass: config.db.password ? '***' : undefined,
  database: config.db.database,
});

export const pool = new Pool({
  host: config.db.host,
  port: config.db.port,
  user: config.db.user,
  password: config.db.password,
  database: config.db.database,
});
