<?php

    use App\Controller\ConfigController;

    require 'vendor/autoload.php';

    $configController = new ConfigController(quiet: true);

    $dbHost     = $configController->getConfig(configKey: 'dbHost');
    $dbPort     = $configController->getConfig(configKey: 'dbPort');
    $dbDatabase = $configController->getConfig(configKey: 'dbDatabase');
    $dbUser     = $configController->getConfig(configKey: 'dbUser');
    $dbPassword = $configController->getConfig(configKey: 'dbPassword');


    // unlike the example config, we don't maintain different environments here,
    // that is set globally, currently by selecting the matching config.json.
    // but that might change to envfiles in the future

    return
        [
            'paths'         => [
                'migrations' => '%%PHINX_CONFIG_DIR%%/db/migrations',
                'seeds'      => '%%PHINX_CONFIG_DIR%%/db/seeds'
            ],
            'environments'  => [
                'default_migration_table' => 'phinxlog',
                'default_environment'     => 'default',
                'default'                 => [
                    'adapter' => 'mysql',
                    'host'    => $dbHost,
                    'name'    => $dbDatabase,
                    'user'    => $dbUser,
                    'pass'    => $dbPassword,
                    'port'    => $dbPort,
                    'charset' => 'utf8',
                ],
            ],
            'version_order' => 'creation'
        ];
