const required = ["NODE_ENV", "PORT", "DB_URL", "JWT_SECRET", "CLIENT_URL", "CLIENT_URLS"];

const missing = required.filter((key) => !process.env[key]);

if (missing.length) {
  console.error(`Missing cPanel environment variables: ${missing.join(", ")}`);
  process.exit(1);
}

if (!process.env.DB_URL.startsWith("postgres://") && !process.env.DB_URL.startsWith("postgresql://")) {
  console.error("DB_URL must be a PostgreSQL connection string.");
  process.exit(1);
}

if (process.env.JWT_SECRET.length < 32) {
  console.error("JWT_SECRET should be at least 32 characters.");
  process.exit(1);
}

console.log("cPanel environment looks ready.");
