<?php

declare(strict_types=1);


$host = strtolower((string) ($_SERVER['HTTP_HOST'] ?? ''));
$host = (string) preg_replace('/:\d+$/', '', $host); // retire un éventuel port

$isLocal = $host === ''                 // ligne de commande (bin/*.php)
    || $host === 'daniel.test'
    || $host === 'www.daniel.test'
    || $host === 'localhost'
    || $host === '127.0.0.1';

if ($isLocal) {
    // ----- LOCAL (Laragon) -----
    return [
        'app' => ['env' => 'local', 'debug' => true],
        'db'  => [
            'host' => '127.0.0.1',
            'port' => '3306',
            'name' => 'daniel',
            'user' => 'root',
            'pass' => '',
        ],
    ];
}

// ----- PRODUCTION (autre domaine) -----

return [
    'app' => ['env' => 'production', 'debug' => false],
    'db'  => [
        'host' => 'localhost',
        'port' => '3306',
        'name' => 'mixer_daniel',
        'user' => 'mixer_daniel',
        'pass' => '4Pad{QM-;pWtW@-T',
    ]
];
