default.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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['php'])) {
  9. $config['base']['php'] = $dc['php'];
  10. }
  11. if (isset($dc['data'])) {
  12. $config['base']['data'] = $dc['data'];
  13. }
  14. # 自动建表
  15. $create = false;
  16. if (isset($dc['mysql']['create'])) {
  17. $create = $dc['mysql']['create'];
  18. }
  19. # 自动建表并删除旧表
  20. $create = -1;
  21. $ip = isset($dc['host']) ? $dc['host'] : '192.168.33.10';
  22. $local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $ip;
  23. # 数据库配置
  24. $config['database'] = array
  25. (
  26. 'create' => $create,
  27. # 默认数据库配置
  28. 'default' => array
  29. (
  30. 'type' => 'pdo',
  31. 'host' => array
  32. (
  33. 'read' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
  34. 'update' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
  35. 'create' => isset($dc['mysql']) ? $dc['mysql']['host_create'] : 'web-mysql:3306',
  36. ),
  37. 'database' => 'info',
  38. 'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
  39. 'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
  40. 'charset' => 'utf8mb4',
  41. ),
  42. );
  43. # 缓存配置
  44. $config['cache'] = array
  45. (
  46. # 启用mysql数据库缓存,这个缓存是根据表名自动生成,dever::load形式和service的all、one形式均自动支持,无需手动添加
  47. 'mysql' => 0,
  48. # 启用页面缓存 会根据当前的url来生成缓存,相当于页面静态化。
  49. 'html' => 0,
  50. # 启用数据级别缓存 这个缓存是程序员自定义的:Dever::cache('name', 'value', 3600);
  51. 'data' => 1800,
  52. # 启用load加载器缓存,一般不加载
  53. 'load' => 0,
  54. # 启用load加载器的远程加载缓存
  55. 'curl' => 0,
  56. # 启用路由缓存
  57. 'route' => 1800,
  58. # 缓存精细控制,根据uri来控制,0则无需缓存
  59. 'routeKey' => array
  60. (
  61. ),
  62. # 哪些路由中的参数不参与生成缓存的key
  63. 'routeNoParam' => array
  64. (
  65. ),
  66. # 缓存清理的参数名,请通过shell=clearcache执行
  67. 'shell' => 'clearcache',
  68. # 是否启用key失效时间记录,启用之后,将会记录每个key的失效时间
  69. 'expire' => true,
  70. # 缓存类型
  71. 'type' => 'redis',//memcache、redis
  72. # 缓存保存方式,支持多个数据源、多台缓存服务器
  73. 'store' => array
  74. (
  75. /*
  76. array
  77. (
  78. 'host' => 'server-redis',
  79. 'port' => '6379',
  80. 'weight' => 100,
  81. 'password' => 'dm_redis_123',
  82. ),
  83. */
  84. ),
  85. );
  86. $config['debug'] = array
  87. (
  88. 'log' => array('type' => 'file')
  89. );
  90. $host = 'http://'.$local . '/';
  91. $upload = $host . 'info/package/';
  92. $uploadcdn = $host . 'info/data/';
  93. $config['host'] = array
  94. (
  95. 'upload'=> $upload . 'upload/?save',
  96. 'uploadRes' => isset($dc['res']) && $dc['res'] ? $dc['res'] : $uploadcdn . 'upload/',
  97. 'project' => array
  98. (
  99. # 自定义资源库,这里不用定义了
  100. 'uploads' => array
  101. (
  102. 'path' => $host. 'upload/upload/?',
  103. ),
  104. ),
  105. );
  106. return $config;