default.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. # 验证dc是否存在,一般在share目录下
  3. $dc = array();
  4. $dc_file = '/share/dc/config.php';
  5. if (is_file($dc_file)) {
  6. $dc = include($dc_file);
  7. }
  8. if (isset($dc['data'])) {
  9. $config['base']['data'] = $dc['data'];
  10. }
  11. $create = false;
  12. if (isset($dc['mysql']['create'])) {
  13. $create = $dc['mysql']['create'];
  14. }
  15. $ip = isset($dc['host']) ? $dc['host'] : '192.168.33.10';
  16. $local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $ip;
  17. # 数据库配置
  18. $config['database'] = array
  19. (
  20. 'create' => $create,
  21. # 默认数据库配置
  22. 'default' => array
  23. (
  24. 'type' => 'pdo',
  25. 'host' => array
  26. (
  27. 'read' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
  28. 'update' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
  29. ),
  30. 'database' => 'wonderful',
  31. 'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
  32. 'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
  33. 'charset' => 'utf8',
  34. ),
  35. );
  36. $config['debug'] = array
  37. (
  38. 'log' => array('type' => 'file'),
  39. );
  40. $host = 'http://'.$local . '/';
  41. $upload = $host . 'upload/';
  42. $uploadcdn = $host . 'upload/data/';
  43. $config['host'] = array
  44. (
  45. 'upload'=> $upload . 'upload/?save',
  46. 'uploadRes' => isset($dc['res']) && $dc['res'] ? $dc['res'] : $uploadcdn . 'upload/',
  47. 'project' => array
  48. (
  49. 'upload' => array
  50. (
  51. 'path' => $host. 'upload/upload/?',
  52. ),
  53. 'pay' => array
  54. (
  55. 'path' => $host. 'pay/pay/?',
  56. ),
  57. 'wechat_applet' => array
  58. (
  59. 'path' => $host. 'wechat/wechat_applet/?',
  60. ),
  61. ),
  62. );
  63. return $config;