<?php
include_once dirname(__DIR__) . '/bootstrap/dotenv.php';

function buildDatabaseConfig(): array {
    $arr = [
        'mysql' => [
            'host' => $_ENV['MYSQL_HOST'],
            'database' => $_ENV['MYSQL_DATABASE'],
            'username' => $_ENV['MYSQL_USER'],
            'password' => $_ENV['MYSQL_PASSWORD']
        ],
        'mysql_copy' => [
            'host' => 'localhost',
            'database' => 'incoviba3',
            'username' => 'incoviba',
            'password' => $_ENV['MYSQL_PASSWORD']
        ]
    ];
    if (isset($_ENV['MYSQL_PORT'])) {
        $arr['mysql']['port'] = $_ENV['MYSQL_PORT'];
    }
    return $arr;
}
return buildDatabaseConfig();
