main.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. return [
  3. 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
  4. 'components' => [
  5. 'request' => [
  6. 'cookieValidationKey' => '3i18DOM7ZDqqQfr2S0hj0c60wFxxTb3J',
  7. 'enableCsrfValidation' => false,
  8. ],
  9. 'cache' => [
  10. 'class' => 'yii\caching\FileCache',
  11. ],
  12. 'db' => [
  13. 'class' => 'yii\db\Connection',
  14. 'dsn' => getenv('DB_DSN'),
  15. 'username' => getenv('DB_USERNAME'),
  16. 'password' => getenv('DB_PASSWORD'),
  17. 'charset' => 'utf8',
  18. ],
  19. 'redis' => [
  20. 'class' => 'yii\redis\Connection',
  21. 'hostname' => getenv('REDIS_HOST'),
  22. 'port' => getenv('REDIS_PORT'),
  23. 'database' => 0,
  24. 'password' => getenv('REDIS_PASSWORD'),
  25. ],
  26. //redis发布与订阅
  27. 'redisPubSub' => [
  28. 'class' => 'hollisho\redis_pub_sub\RedisPubSub',
  29. 'connect' => [
  30. 'class' => 'yii\redis\Connection',
  31. 'hostname' => getenv('REDIS_HOST'),
  32. 'port' => getenv('REDIS_PORT'),
  33. 'database' => getenv('REDIS_DB'),
  34. 'password' => getenv('REDIS_PASSWORD'),
  35. 'connectionTimeout' => 20,
  36. ]
  37. ],
  38. 'dict' => [
  39. 'class' => 'common\components\configDict',
  40. ],
  41. 'mailer' => [
  42. 'class' => 'yii\swiftmailer\Mailer',
  43. 'useFileTransport' => false,
  44. 'transport' => [
  45. 'class' => 'Swift_SmtpTransport',
  46. 'host' => 'smtp.126.com',
  47. 'username' => 'zhhinc@126.com',
  48. 'password' => '',
  49. 'port' => '25',
  50. 'encryption' => 'tls',
  51. ],
  52. 'messageConfig' => [
  53. 'charset' => 'UTF-8',
  54. 'from' => ['zhhinc@126.com' => '系统邮件']
  55. ],
  56. ],
  57. 'rabbitmq' => require(__DIR__ . '/rabbitMQ.php'),
  58. ],
  59. ];