import mysql from "mysql2/promise";
import dotenv from "dotenv";

dotenv.config();

const {
  DB_HOST = "127.0.0.1",
  DB_PORT = "3306",
  DB_USER = "root",
  DB_PASSWORD = "12345"
} = process.env;

/** Single shared MySQL schema for SAT and Risk Assessment (not overridable). */
const HSE_DATABASE = "hse";

export const pool = mysql.createPool({
  host: DB_HOST,
  port: Number(DB_PORT),
  user: DB_USER,
  password: DB_PASSWORD,
  database: HSE_DATABASE,
  waitForConnections: true,
  connectionLimit: 10,
  queueLimit: 0
});

