<?php

date_default_timezone_set('Europe/Kiev');


Yii::setAlias('@tests', dirname(__DIR__) . '/tests');

$params = require(__DIR__ . '/params.php');
$db = require(__DIR__ . '/db.php');

return [
    'id' => 'basic-console',
    'name'  =>  'UmsTrade',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log', 'gii'],
    'controllerNamespace' => 'app\commands',
    'modules' => [
        'gii' => 'yii\gii\Module',
    ],
    'components' => [
        'formatter' => [
            'dateFormat' => 'dd.MM.Y',
            'datetimeFormat' => 'php:d.m.Y H:i:s',
            'timeFormat' => 'H:i:s',
            'locale' => 'uk',
            'defaultTimeZone' => 'Europe/Kiev',
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        /*
        'authManager' => [
            'class' => 'yii\rbac\PhpManager',
        ],
        */
        'authManager' => [
            'class' => 'yii\rbac\DbManager',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => false,
            'viewPath' => '@app/mailer',
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => getenv('SMTP_HOST'),
                'username' => getenv('SMTP_USER'),
                'password' => getenv('SMTP_PASS'),
                'port' => getenv('SMTP_PORT'),
                'encryption' => getenv('SMTP_ENC'),
            ],
        ],
        'log' => [
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'urlManager' => [
            'scriptUrl' => 'http://umstrade.com.ua',
            'baseUrl' => 'http://umstrade.com.ua',
            'showScriptName' => false,
            'enablePrettyUrl' => true,
        ],
        'db' => $db,
    ],
    'params' => $params,
];
