<?php
$mainConfig = require_once __DIR__ . '/config.php';

return [
    'language' => 'zh-CN',
    'timeZone' => 'PRC',
    'aliases' => [
        '@bower' => '@vendor/bower-asset',
        '@npm'   => '@vendor/npm-asset',
//        'anlity/swooleAsyncTimer' => '@backend/runtime/tmp-extensions/yii2-swoole-async-timer',
    ],
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'components' => [
        'db' => array_merge([
            'class' => 'yii\db\Connection',
            'enableSlaves' => false,
//            'enableSavepoint' => false,
        ], $mainConfig['db'], $mainConfig['slavesDb']),
//        'dbShop' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema']], $mainConfig['dbShop']),
        'dbLog' => array_merge(['class' => 'yii\mongodb\Connection',], $mainConfig['dbLog']),
        'dbCalc' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalc']),
//        'dbShopCalc' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema'],], $mainConfig['dbShopCalc']),
        'dbNetPoint' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbNetPoint']),
        // 'cache' => [
        //     //'class' => 'yii\caching\FileCache',
        //     //'class' => 'dcb9\redis\Cache',
        //     'class' => \yii\redis\Cache::class,
        //     'redis' => $mainConfig['cacheRedis'],
        // ],
        'cache' => [
            'class' => 'yii\redis\Cache',
            //'redis' => $mainConfig['cacheRedis'],
            'redis' => [
                'hostname' => '127.0.0.1',
                'port' => 6379,
                'database' => 0,
            ]
        ],
        'tokenRedis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['tokenRedis']),
        'redis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['otherRedis']),
        // 'tokenRedis' => array_merge(['class' => \yii\redis\Cache::class], $mainConfig['tokenRedis']),
        // 'redis' => array_merge(['class' => \yii\redis\Cache::class], $mainConfig['otherRedis']),
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
        'swooleAsyncTimer' => [
            'class' => 'common\components\SwooleAsyncTimer',
        ],
    ],
    'controllerMap' => [
        'swoole_server' => [
            'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
        ],
    ],
];
