main.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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\caching\FileCache',
  25. // 'class' => 'dcb9\redis\Cache',
  26. // 'redis' => $mainConfig['cacheRedis'],
  27. // ],
  28. 'cache' => [
  29. 'class' => 'yii\redis\Cache',
  30. 'redis' => $mainConfig['cacheRedis'],
  31. // 'redis' => [
  32. // 'hostname' => '127.0.0.1',
  33. // 'port' => 6379,
  34. // 'database' => 0,
  35. // ]
  36. ],
  37. 'tokenRedis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['tokenRedis']),
  38. 'redis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['otherRedis']),
  39. // 'tokenRedis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['tokenRedis']),
  40. // 'redis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['otherRedis']),
  41. 'mailer' => [
  42. 'class' => 'yii\swiftmailer\Mailer',
  43. 'viewPath' => '@common/mail',
  44. // send all mails to a file by default. You have to set
  45. // 'useFileTransport' to false and configure a transport
  46. // for the mailer to send real emails.
  47. 'useFileTransport' => true,
  48. ],
  49. 'swooleAsyncTimer' => [
  50. 'class' => 'common\components\SwooleAsyncTimer',
  51. ],
  52. // payStack配置
  53. 'Paystack' => [
  54. 'class' => 'smladeoye\paystack\Paystack',
  55. 'environment' => 'test',
  56. 'testPublicKey' => 'pk_test_2eed10135c4a958c5073795b22854ded9d1a6c55',
  57. 'testSecretKey' => 'sk_test_5ece72377432376f5cf6bb5c468395a650220309',
  58. 'livePublicKey' => '',
  59. 'liveSecretKey' => '',
  60. ],
  61. // 配置SQL语句输出
  62. 'log' => [
  63. 'traceLevel' => YII_DEBUG ? 3 : 0,
  64. 'targets' => [
  65. [
  66. 'class' => 'yii\log\FileTarget',
  67. 'levels' => ['error', 'warning', 'info'],
  68. 'categories' => ['yii\db\*', 'app\models\*'],
  69. 'logFile' => '@runtime/logs/sql.log',
  70. ],
  71. 'db' => [ 'class' => 'yii\log\FileTarget'],
  72. ],
  73. ],
  74. ],
  75. 'controllerMap' => [
  76. 'swoole_server' => [
  77. 'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
  78. ],
  79. ],
  80. ];