main.php 3.8 KB

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