Guest User

Untitled

a guest
Oct 30th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. <?php
  2.  
  3. $url = parse_url(getenv("CLEARDB_DATABASE_URL"));
  4.  
  5. $host = $url["host"] ?? null;
  6. $username = $url["user"] ?? null;
  7. $password = $url["pass"] ?? null;
  8. $database = substr($url["path"], 1);
  9.  
  10. return [
  11.  
  12. /*
  13. |--------------------------------------------------------------------------
  14. | Default Database Connection Name
  15. |--------------------------------------------------------------------------
  16. |
  17. | Here you may specify which of the database connections below you wish
  18. | to use as your default connection for all database work. Of course
  19. | you may use many connections at once using the Database library.
  20. |
  21. */
  22.  
  23. 'default' => env('DB_CONNECTION', 'mysql_heroku_production'),
  24.  
  25. /*
  26. |--------------------------------------------------------------------------
  27. | Database Connections
  28. |--------------------------------------------------------------------------
  29. |
  30. | Here are each of the database connections setup for your application.
  31. | Of course, examples of configuring each database platform that is
  32. | supported by Laravel is shown below to make development simple.
  33. |
  34. |
  35. | All database work in Laravel is done through the PHP PDO facilities
  36. | so make sure you have the driver for your particular database of
  37. | choice installed on your machine before you begin development.
  38. |
  39. */
  40.  
  41. 'connections' => [
  42.  
  43. 'sqlite' => [
  44. 'driver' => 'sqlite',
  45. 'database' => env('DB_DATABASE', database_path('database.sqlite')),
  46. 'prefix' => '',
  47. ],
  48.  
  49. 'mysql' => [
  50. 'driver' => 'mysql',
  51. 'host' => env('DB_HOST', '127.0.0.1'),
  52. 'port' => env('DB_PORT', '3306'),
  53. 'database' => env('DB_DATABASE', 'forge'),
  54. 'username' => env('DB_USERNAME', 'forge'),
  55. 'password' => env('DB_PASSWORD', ''),
  56. 'unix_socket' => env('DB_SOCKET', ''),
  57. 'charset' => 'utf8mb4',
  58. 'collation' => 'utf8mb4_unicode_ci',
  59. 'prefix' => '',
  60. 'strict' => true,
  61. 'engine' => null,
  62. ],
  63.  
  64. 'mysql_heroku_production' => array(
  65. 'driver' => 'mysql',
  66. 'host' => $host,
  67. 'database' => $database,
  68. 'username' => $username,
  69. 'password' => $password,
  70. 'charset' => 'utf8',
  71. 'collation' => 'utf8_unicode_ci',
  72. 'prefix' => '',
  73. ),
  74.  
  75. 'pgsql' => [
  76. 'driver' => 'pgsql',
  77. 'host' => env('DB_HOST', '127.0.0.1'),
  78. 'port' => env('DB_PORT', '5432'),
  79. 'database' => env('DB_DATABASE', 'forge'),
  80. 'username' => env('DB_USERNAME', 'forge'),
  81. 'password' => env('DB_PASSWORD', ''),
  82. 'charset' => 'utf8',
  83. 'prefix' => '',
  84. 'schema' => 'public',
  85. 'sslmode' => 'prefer',
  86. ],
  87.  
  88. 'sqlsrv' => [
  89. 'driver' => 'sqlsrv',
  90. 'host' => env('DB_HOST', 'localhost'),
  91. 'port' => env('DB_PORT', '1433'),
  92. 'database' => env('DB_DATABASE', 'forge'),
  93. 'username' => env('DB_USERNAME', 'forge'),
  94. 'password' => env('DB_PASSWORD', ''),
  95. 'charset' => 'utf8',
  96. 'prefix' => '',
  97. ],
  98.  
  99. ],
  100.  
  101. /*
  102. |--------------------------------------------------------------------------
  103. | Migration Repository Table
  104. |--------------------------------------------------------------------------
  105. |
  106. | This table keeps track of all the migrations that have already run for
  107. | your application. Using this information, we can determine which of
  108. | the migrations on disk haven't actually been run in the database.
  109. |
  110. */
  111.  
  112. 'migrations' => 'migrations',
  113.  
  114. /*
  115. |--------------------------------------------------------------------------
  116. | Redis Databases
  117. |--------------------------------------------------------------------------
  118. |
  119. | Redis is an open source, fast, and advanced key-value store that also
  120. | provides a richer set of commands than a typical key-value systems
  121. | such as APC or Memcached. Laravel makes it easy to dig right in.
  122. |
  123. */
  124.  
  125. 'redis' => [
  126.  
  127. 'client' => 'predis',
  128.  
  129. 'default' => [
  130. 'host' => env('REDIS_HOST', '127.0.0.1'),
  131. 'password' => env('REDIS_PASSWORD', null),
  132. 'port' => env('REDIS_PORT', 6379),
  133. 'database' => env('REDIS_DB', 0),
  134. ],
  135.  
  136. 'cache' => [
  137. 'host' => env('REDIS_HOST', '127.0.0.1'),
  138. 'password' => env('REDIS_PASSWORD', null),
  139. 'port' => env('REDIS_PORT', 6379),
  140. 'database' => env('REDIS_CACHE_DB', 1),
  141. ],
  142.  
  143. ],
  144.  
  145. ];
Add Comment
Please, Sign In to add comment