main.php 4.0 KB

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