<?php
// Database configuration for deployment (e.g., cPanel)
// Edit these values on the server to match your MySQL setup.
// Example cPanel values:
// - DB_HOST: usually 'localhost'
// - DB_USER: 'cpaneluser_dbuser'
// - DB_PASS: 'your-strong-password'
// - DB_NAME: 'cpaneluser_ironsurveyform'

// Values default to environment variables if set, otherwise to local dev defaults.
if (!defined('DB_HOST')) {
  define('DB_HOST', getenv('DB_HOST') ?: 'localhost');
}
if (!defined('DB_USER')) {
  define('DB_USER', getenv('DB_USER') ?: 'imefotxb_tpieceuser1');
}
if (!defined('DB_PASS')) {
  define('DB_PASS', getenv('DB_PASS') ?: '6xKf_b?rGQLn');
}
if (!defined('DB_NAME')) {
  define('DB_NAME', getenv('DB_NAME') ?: 'imefotxb_tpiece');
}
// Only allow database creation on local/dev; set to true for XAMPP, false for cPanel
if (!defined('ALLOW_DB_CREATE')) {
  $envFlag = getenv('ALLOW_DB_CREATE');
  // Default to false for cPanel to prevent permission errors
  $defaultLocal = false;
  define('ALLOW_DB_CREATE', $envFlag ? in_array(strtolower($envFlag), ['1','true','yes'], true) : $defaultLocal);
}