main.php 4.0 KB

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