main.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. ],
  10. 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
  11. 'components' => [
  12. 'db' => array_merge([
  13. 'class' => 'yii\db\Connection',
  14. 'enableSlaves' => false,
  15. ], $mainConfig['db'], $mainConfig['slavesDb']),
  16. 'dbLog' => array_merge(['class' => 'yii\mongodb\Connection',], $mainConfig['dbLog']),
  17. 'dbCalc' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalc']),
  18. 'dbNetPoint' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbNetPoint']),
  19. 'cache' => [
  20. 'class' => 'yii\redis\Cache',
  21. 'redis' => $mainConfig['cacheRedis']
  22. // 'redis' => [
  23. // 'hostname' => '127.0.0.1',
  24. // 'port' => 6379,
  25. // 'database' => 0,
  26. // ]
  27. ],
  28. 'tokenRedis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['tokenRedis']),
  29. 'redis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['otherRedis']),
  30. 'mailer' => [
  31. 'class' => 'yii\swiftmailer\Mailer',
  32. 'viewPath' => '@common/mail',
  33. // send all mails to a file by default. You have to set
  34. // 'useFileTransport' to false and configure a transport
  35. // for the mailer to send real emails.
  36. 'useFileTransport' => true,
  37. ],
  38. 'swooleAsyncTimer' => [
  39. 'class' => 'common\components\SwooleAsyncTimer',
  40. ],
  41. ],
  42. 'controllerMap' => [
  43. 'swoole_server' => [
  44. 'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
  45. ],
  46. ],
  47. ];