main.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. $mainConfig = require_once __DIR__ . '/config.php';
  3. return [
  4. 'language' => 'zh-CN',
  5. 'timeZone' => 'PRC',
  6. 'aliases' => [
  7. '@bower' => '@vendor/bower-asset',
  8. '@npm' => '@vendor/npm-asset',
  9. // 'anlity/swooleAsyncTimer' => '@backend/runtime/tmp-extensions/yii2-swoole-async-timer',
  10. ],
  11. 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
  12. 'components' => [
  13. // 'log' => [
  14. // 'targets' => [
  15. // [
  16. // 'class' => 'yii\log\FileTarget',
  17. // 'levels' => ['error', 'warning', 'info'],
  18. // 'categories' => ['yii\db\*', 'app\models\*'],
  19. // 'logFile' => '@runtime/logs/sql.log',
  20. // ],
  21. // 'db' => [ 'class' => 'yii\log\FileTarget'],
  22. // ],
  23. // ],
  24. 'db' => array_merge([
  25. 'class' => 'yii\db\Connection',
  26. 'enableSlaves' => false,
  27. // 'enableSavepoint' => false,
  28. ], $mainConfig['db'], $mainConfig['slavesDb']),
  29. // 'dbShop' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema']], $mainConfig['dbShop']),
  30. 'dbLog' => array_merge(['class' => 'yii\mongodb\Connection',], $mainConfig['dbLog']),
  31. 'dbCalc' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalc']),
  32. // 'dbShopCalc' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema'],], $mainConfig['dbShopCalc']),
  33. 'dbNetPoint' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbNetPoint']),
  34. // 'cache' => [
  35. // //'class' => 'yii\caching\FileCache',
  36. // 'class' => 'dcb9\redis\Cache',
  37. // 'redis' => $mainConfig['cacheRedis'],
  38. // ],
  39. 'cache' => [
  40. 'class' => 'yii\redis\Cache',
  41. 'redis' => $mainConfig['cacheRedis'],
  42. // 'redis' => [
  43. // 'hostname' => '127.0.0.1',
  44. // 'port' => 6379,
  45. // 'database' => 0,
  46. // ]
  47. ],
  48. 'tokenRedis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['tokenRedis']),
  49. 'redis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['otherRedis']),
  50. // 'tokenRedis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['tokenRedis']),
  51. // 'redis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['otherRedis']),
  52. 'mailer' => [
  53. 'class' => 'yii\swiftmailer\Mailer',
  54. 'viewPath' => '@common/mail',
  55. // send all mails to a file by default. You have to set
  56. // 'useFileTransport' to false and configure a transport
  57. // for the mailer to send real emails.
  58. 'useFileTransport' => true,
  59. ],
  60. 'swooleAsyncTimer' => [
  61. 'class' => 'common\components\SwooleAsyncTimer',
  62. ],
  63. ],
  64. 'controllerMap' => [
  65. 'swoole_server' => [
  66. 'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
  67. ],
  68. ],
  69. ];