database.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?php
  2. use Illuminate\Support\Str;
  3. return [
  4. /*
  5. |--------------------------------------------------------------------------
  6. | Default Database Connection Name
  7. |--------------------------------------------------------------------------
  8. |
  9. | Here you may specify which of the database connections below you wish
  10. | to use as your default connection for all database work. Of course
  11. | you may use many connections at once using the Database library.
  12. |
  13. */
  14. 'default' => env('DB_CONNECTION', 'mysql'),
  15. /*
  16. |--------------------------------------------------------------------------
  17. | Database Connections
  18. |--------------------------------------------------------------------------
  19. |
  20. | Here are each of the database connections setup for your application.
  21. | Of course, examples of configuring each database platform that is
  22. | supported by Laravel is shown below to make development simple.
  23. |
  24. |
  25. | All database work in Laravel is done through the PHP PDO facilities
  26. | so make sure you have the driver for your particular database of
  27. | choice installed on your machine before you begin development.
  28. |
  29. */
  30. 'connections' => [
  31. 'sqlite' => [
  32. 'driver' => 'sqlite',
  33. 'url' => env('DATABASE_URL'),
  34. 'database' => env('DB_DATABASE', database_path('database.sqlite')),
  35. 'prefix' => '',
  36. 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
  37. ],
  38. 'mysql' => [
  39. 'driver' => 'mysql',
  40. 'url' => env('DATABASE_URL'),
  41. // 'host' => env('DB_HOST', '127.0.0.1'),
  42. 'read' => [
  43. 'host' => env('DB_READ_HOST', 'localhost'),
  44. ],
  45. 'write' => [
  46. 'host' => env('DB_WRITE_HOST', 'localhost'),
  47. ],
  48. 'sticky' => true,
  49. 'port' => env('DB_PORT', '3306'),
  50. 'database' => env('DB_DATABASE', 'forge'),
  51. 'username' => env('DB_USERNAME', 'forge'),
  52. 'password' => env('DB_PASSWORD', ''),
  53. 'unix_socket' => env('DB_SOCKET', ''),
  54. 'charset' => 'utf8mb4',
  55. 'collation' => 'utf8mb4_unicode_ci',
  56. 'prefix' => '',
  57. 'prefix_indexes' => true,
  58. 'strict' => false,
  59. 'engine' => null,
  60. 'options' => extension_loaded('pdo_mysql') ? array_filter([
  61. PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
  62. ]) : [],
  63. ],
  64. 'pgsql' => [
  65. 'driver' => 'pgsql',
  66. 'url' => env('DATABASE_URL'),
  67. 'host' => env('DB_HOST', '127.0.0.1'),
  68. 'port' => env('DB_PORT', '5432'),
  69. 'database' => env('DB_DATABASE', 'forge'),
  70. 'username' => env('DB_USERNAME', 'forge'),
  71. 'password' => env('DB_PASSWORD', ''),
  72. 'charset' => 'utf8',
  73. 'prefix' => '',
  74. 'prefix_indexes' => true,
  75. 'schema' => 'public',
  76. 'sslmode' => 'prefer',
  77. ],
  78. 'sqlsrv' => [
  79. 'driver' => 'sqlsrv',
  80. 'url' => env('DATABASE_URL'),
  81. 'host' => env('DB_HOST', 'localhost'),
  82. 'port' => env('DB_PORT', '1433'),
  83. 'database' => env('DB_DATABASE', 'forge'),
  84. 'username' => env('DB_USERNAME', 'forge'),
  85. 'password' => env('DB_PASSWORD', ''),
  86. 'charset' => 'utf8',
  87. 'prefix' => '',
  88. 'prefix_indexes' => true,
  89. ],
  90. 'read_record_mysql' => [
  91. 'driver' => 'mysql',
  92. 'host' => env('READ_RECORD_DB_HOST', 'localhost'),
  93. 'port' => env('READ_RECORD_DB_PORT', '3306'),
  94. 'database' => env('READ_RECORD_DB_DATABASE','yc_douyin_read_record'),
  95. 'username' => env('READ_RECORD_DB_USERNAME', 'forge'),
  96. 'password' => env('READ_RECORD_DB_PASSWORD', ''),
  97. 'charset' => 'utf8',
  98. 'collation' => 'utf8_unicode_ci',
  99. 'prefix' => '',
  100. 'strict' => false,
  101. 'engine' => null,
  102. ],
  103. 'chapter_order_mysql' => [
  104. 'driver' => 'mysql',
  105. 'host' => env('SUBS_DB_HOST', 'localhost'),
  106. 'port' => env('SUBS_DB_PORT', '3306'),
  107. 'database' => env('SUBS_DB_DATABASE','yc_douyin_subs'),
  108. 'username' => env('SUBS_DB_USERNAME', 'forge'),
  109. 'password' => env('SUBS_DB_PASSWORD', ''),
  110. 'charset' => 'utf8',
  111. 'collation' => 'utf8_unicode_ci',
  112. 'prefix' => '',
  113. 'strict' => false,
  114. 'engine' => null,
  115. ],
  116. 'zw_content_mysql' => [
  117. 'driver' => 'mysql',
  118. 'host' => env('ZW_CONTENT_DB_HOST', 'localhost'),
  119. 'port' => env('ZW_CONTENT_DB_PORT', '3306'),
  120. 'database' => env('ZW_CONTENT_DB_DATABASE','yc_douyin_read_record'),
  121. 'username' => env('ZW_CONTENT_DB_USERNAME', 'forge'),
  122. 'password' => env('ZW_CONTENT_DB_PASSWORD', ''),
  123. 'charset' => 'utf8',
  124. 'collation' => 'utf8_unicode_ci',
  125. 'prefix' => '',
  126. 'strict' => false,
  127. 'engine' => null,
  128. ],
  129. ],
  130. /*
  131. |--------------------------------------------------------------------------
  132. | Migration Repository Table
  133. |--------------------------------------------------------------------------
  134. |
  135. | This table keeps track of all the migrations that have already run for
  136. | your application. Using this information, we can determine which of
  137. | the migrations on disk haven't actually been run in the database.
  138. |
  139. */
  140. 'migrations' => 'migrations',
  141. /*
  142. |--------------------------------------------------------------------------
  143. | Redis Databases
  144. |--------------------------------------------------------------------------
  145. |
  146. | Redis is an open source, fast, and advanced key-value store that also
  147. | provides a richer body of commands than a typical key-value system
  148. | such as APC or Memcached. Laravel makes it easy to dig right in.
  149. |
  150. */
  151. 'redis' => [
  152. // 'client' => env('REDIS_CLIENT', 'phpredis'),
  153. 'client' => env('REDIS_CLIENT', 'predis'),
  154. 'options' => [
  155. 'cluster' => env('REDIS_CLUSTER', 'redis'),
  156. 'prefix' => env('REDIS_PREFIX', ''),
  157. ],
  158. 'default' => [
  159. // 'url' => env('REDIS_URL'),
  160. 'host' => env('REDIS_HOST', '127.0.0.1'),
  161. 'password' => env('REDIS_PASSWORD', null),
  162. 'port' => env('REDIS_PORT', '6379'),
  163. 'database' => env('REDIS_DB', '0'),
  164. ],
  165. 'cache' => [
  166. 'url' => env('REDIS_URL'),
  167. 'host' => env('REDIS_HOST', '127.0.0.1'),
  168. 'password' => env('REDIS_PASSWORD', null),
  169. 'port' => env('REDIS_PORT', '6379'),
  170. 'database' => env('REDIS_CACHE_DB', '1'),
  171. ],
  172. ],
  173. ];