Skip to content
Snippets Groups Projects
settings.php 1.85 KiB
<?php
declare(strict_types=1);

use DI\ContainerBuilder;
use Monolog\Logger;

return function (ContainerBuilder $containerBuilder) {
    // Global Settings Object
    $containerBuilder->addDefinitions(
        [
        'settings' => [
            'displayErrorDetails' => true, // Should be set to false in production
            'logger' => [
                'name' => 'slim-app',
                'path' => isset($_ENV['docker']) ? 'php://stdout' : __DIR__ . '/../logs/app.log',
                'level' => Logger::DEBUG,
            ],
            'doctrine' => [
                // if true, metadata caching is forcefully disabled
                'dev_mode' => true,

                // path where the compiled metadata info will be cached
                // make sure the path exists and it is writable
                'cache_dir' => __DIR__ . '/../var/doctrine',

                // you should add any other path containing annotated entity classes
                'metadata_dirs' => [__DIR__ . '/../src/Domain'],

                'connection' => [
                    'driver' => 'pdo_mysql',
                    'host' => 'db',
                    'port' => 3306,
                    'dbname' => getenv('MYSQL_DATABASE'),
                    'user' => getenv('MYSQL_USER'),
                    'password' => getenv('MYSQL_PASSWORD'),
                    //'charset' => 'utf-8'
                    ]
                ],
                'twig' => [
                    'paths' => [
                        __DIR__ . '/../templates',
                    ],
                    // Twig environment options
                    'options' => [
                        // Should be set to true in production
                        'cache_enabled' => false,
                        'cache_path' => __DIR__ . '/../var/twig',
                    ],
                ]
        ],
        ]
    );
};