<?php
$params = array_merge(
    require __DIR__ . '/../../common/config/params.php',
    require __DIR__ . '/../../common/config/params-swoole.php',
//    require __DIR__ . '/../../common/config/params-rpc.php',
    require __DIR__ . '/params.php'
);

return [
    'language' => 'zh-CN',
    'sourceLanguage' => 'en-US',
    'timeZone' => 'Africa/Lagos',
    'id' => 'app-console',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'console\controllers',
    'aliases' => [
        '@bower' => '@vendor/bower-asset',
        '@npm'   => '@vendor/npm-asset',
        //'anlity/swooleAsyncTimer' => '@backend/runtime/tmp-extensions/yii2-swoole-async-timer',
    ],
    'controllerMap' => [
        'fixture' => [
            'class' => 'yii\console\controllers\FixtureController',
            'namespace' => 'common\fixtures',
        ],
//        'swoole_rpc' => [
//            'class' => 'common\libs\swoole\RPCController',
//        ],
    ],
    'components' => [
        'log' => [
            'flushInterval' => 1,
            'targets' => [
                [
                    'class' => 'common\components\AsyncFileTarget',
                    'levels' => ['error', 'warning', 'info', 'trace'],
                    'logVars'=>[],
                    'categories' => ['export', 'rpc'],
                    'logFile' => '@common/runtime/logs/console/'.date('Ymd').'.log',
                    'maxFileSize' => 1024 * 5,
                    'maxLogFiles' => 150,
                    'exportInterval' => 1,
                ],
                /*[
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'info'],
                    'logVars'=>[],
                    'logFile' => '@console/runtime/logs/'.date('Ymd').'.log',
                    'maxFileSize' => 1024 * 5,
                    'maxLogFiles' => 150,
                    'exportInterval' => 1,
                ],*/
            ],
        ],
        // 多语言
        'i18n' => [
            'translations' => [
                'app*' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@common/messages',
                    'fileMap' => [
                        'app' => 'app.php',
                        'app/error' => 'error.php',
                    ],
                ],
                'ctx*' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@common/messages',
                    'fileMap' => [
                        'ctx' => 'ctx.php',
                        'ctx/error' => 'error.php',
                    ],
                ],
            ],
        ],
    ],
    'params' => $params,
];
