main.php 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. // 根据运行环境加载不同的配置文件
  3. if (YII_ENV == YII_ENV_DEV) {
  4. $mainConfig = require_once __DIR__ . '/config-development.php';
  5. } else if (YII_ENV == YII_ENV_TEST) {
  6. $mainConfig = require_once __DIR__ . '/config-test.php';
  7. } else if (YII_ENV == YII_ENV_PROD) {
  8. $mainConfig = require_once __DIR__ . '/config-product.php';
  9. } else {
  10. $mainConfig = require_once __DIR__ . '/config-development.php';
  11. }
  12. return [
  13. 'language' => 'en',
  14. 'timeZone' => 'Africa/Lagos',
  15. 'aliases' => [
  16. '@bower' => '@vendor/bower-asset',
  17. '@npm' => '@vendor/npm-asset',
  18. // 'anlity/swooleAsyncTimer' => '@backend/runtime/tmp-extensions/yii2-swoole-async-timer',
  19. ],
  20. 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
  21. 'components' => [
  22. 'db' => array_merge([
  23. 'class' => 'yii\db\Connection',
  24. 'enableSlaves' => false,
  25. // 'enableSavepoint' => false,
  26. ], $mainConfig['db'], $mainConfig['slavesDb']),
  27. // 'dbShop' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema']], $mainConfig['dbShop']),
  28. 'dbLog' => array_merge(['class' => 'yii\mongodb\Connection',], $mainConfig['dbLog']),
  29. 'dbCalc' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalc']),
  30. 'dbCalcServer' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalcServer']),
  31. // 'dbShopCalc' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema'],], $mainConfig['dbShopCalc']),
  32. 'dbNetPoint' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbNetPoint']),
  33. // 'cache' => [
  34. // //'class' => 'yii\caching\FileCache',
  35. // 'class' => 'dcb9\redis\Cache',
  36. // 'redis' => $mainConfig['cacheRedis'],
  37. // ],
  38. 'cache' => [
  39. 'class' => 'yii\redis\Cache',
  40. 'redis' => $mainConfig['cacheRedis'],
  41. // 'redis' => [
  42. // 'hostname' => '127.0.0.1',
  43. // 'port' => 6379,
  44. // 'database' => 0,
  45. // ]
  46. ],
  47. 'tokenRedis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['tokenRedis']),
  48. 'redis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['otherRedis']),
  49. // 'tokenRedis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['tokenRedis']),
  50. // 'redis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['otherRedis']),
  51. 'mailer' => [
  52. 'class' => 'yii\swiftmailer\Mailer',
  53. 'viewPath' => '@common/mail',
  54. // send all mails to a file by default. You have to set
  55. // 'useFileTransport' to false and configure a transport
  56. // for the mailer to send real emails.
  57. 'useFileTransport' => true,
  58. ],
  59. 'swooleAsyncTimer' => [
  60. 'class' => 'common\components\SwooleAsyncTimer',
  61. ],
  62. // payStack配置
  63. 'Paystack' => [
  64. 'class' => 'smladeoye\paystack\Paystack',
  65. 'environment' => YII_ENV,
  66. 'testPublicKey' => 'pk_test_2eed10135c4a958c5073795b22854ded9d1a6c55',
  67. 'testSecretKey' => 'sk_test_5ece72377432376f5cf6bb5c468395a650220309',
  68. 'livePublicKey' => 'pk_live_fae524f9d073d877beeb661fd825a37a9bc91f0a',
  69. 'liveSecretKey' => 'sk_live_b93c6bbee2cc0e9c594547bf4779ec9852b9d055',
  70. ],
  71. // 配置SQL语句输出
  72. 'log' => [
  73. 'traceLevel' => YII_DEBUG ? 3 : 0,
  74. 'targets' => [
  75. [
  76. 'class' => 'yii\log\FileTarget',
  77. 'levels' => ['error', 'warning', 'info'],
  78. 'categories' => ['yii\db\*', 'app\models\*'],
  79. 'logFile' => '@runtime/logs/sql.log',
  80. ],
  81. 'db' => [ 'class' => 'yii\log\FileTarget'],
  82. ],
  83. ],
  84. ],
  85. 'controllerMap' => [
  86. 'swoole_server' => [
  87. 'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
  88. ],
  89. ],
  90. ];