main.php 2.4 KB

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