database.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * This file is part of webman.
  4. *
  5. * Licensed under The MIT License
  6. * For full copyright and license information, please see the MIT-LICENSE.txt
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @author walkor<walkor@workerman.net>
  10. * @copyright walkor<walkor@workerman.net>
  11. * @link http://www.workerman.net/
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. return [
  15. // 默认数据库
  16. 'default' => 'mysql',
  17. // 各种数据库配置
  18. 'connections' => [
  19. 'mysql' => [
  20. 'driver' => 'mysql',
  21. 'host' => getenv('DB_HOST'),
  22. 'port' => getenv('DB_PORT'),
  23. 'database' => getenv('DB_NAME'),
  24. 'username' => getenv('DB_USER'),
  25. 'password' => getenv('DB_PASSWORD'),
  26. 'unix_socket' => '',
  27. 'charset' => 'utf8',
  28. 'collation' => 'utf8_unicode_ci',
  29. 'prefix' => getenv('DB_PREFIX',''),
  30. 'strict' => true,
  31. 'engine' => null,
  32. ],
  33. 'sqlite' => [
  34. 'driver' => 'sqlite',
  35. 'database' => '',
  36. 'prefix' => '',
  37. ],
  38. 'pgsql' => [
  39. 'driver' => 'pgsql',
  40. 'host' => '127.0.0.1',
  41. 'port' => 5432,
  42. 'database' => 'webman',
  43. 'username' => 'webman',
  44. 'password' => '',
  45. 'charset' => 'utf8',
  46. 'prefix' => '',
  47. 'schema' => 'public',
  48. 'sslmode' => 'prefer',
  49. ],
  50. 'sqlsrv' => [
  51. 'driver' => 'sqlsrv',
  52. 'host' => 'localhost',
  53. 'port' => 1433,
  54. 'database' => 'webman',
  55. 'username' => 'webman',
  56. 'password' => '',
  57. 'charset' => 'utf8',
  58. 'prefix' => '',
  59. ],
  60. ],
  61. ];