main.php 3.9 KB

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