
<?php
use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(dirname(__DIR__, 2));
$dotenv->load();

return [
  'debug' => $_ENV['DEBUG'],
  'databases' => function() {
    $default = [
      'system' => 'mysql',
      'host' => (object) [
        'name' => $_ENV['DB_HOST'] ?? 'localhost'
      ],
      'user' => (object) [
        'name' => $_ENV['DB_USER'] ?? 'money',
        'password' => $_ENV['DB_PASSWORD'] ?? 'password'
      ],
      'name' => $_ENV['DB_NAME'] ?? 'money'
    ];
    if (isset($_ENV['DB_PORT'])) {
      $default['host']->port = $_ENV['DB_PORT'];
    }
    $arr = [
      'short_names' => true,
      'default' => (object) $default
    ];
    return (object) $arr;
  }
];
