default.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?php
  2. # 验证dc是否存在,一般在share目录下
  3. $dc = array();
  4. $dc_file = '/data/dm/container/share/dc/config.php';
  5. if (is_file($dc_file)) {
  6. $dc = include($dc_file);
  7. }
  8. # 基本配置
  9. $config['base'] = array
  10. (
  11. # api文档生成是否开启,开启后,将会根据访问来生成文档。生产环境建议禁止
  12. 'apiDoc' => true,
  13. # api日志是否开启,开启后,将会记录所有带有_api后缀方法的请求参数和响应参数
  14. 'apiLog' => true,
  15. # 定义自动转为api的目录,可以将该目录下的所有类的公共方法,都转为可以访问的api,开启该功能可能有安全性问题。
  16. 'apiOpenPath' => 'src',
  17. # 启用后,将会根据api目录下的配置文件自动定位api
  18. 'apiConfig' => false,
  19. );
  20. if (isset($dc['data'])) {
  21. $config['base']['data'] = $dc['data'];
  22. }
  23. $create = false;
  24. if (isset($dc['mysql']['create'])) {
  25. $create = false;
  26. }
  27. $create = -1;
  28. $ip = isset($dc['host']) ? $dc['host'] : '192.168.33.10';
  29. $local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $ip;
  30. # 数据库配置
  31. $config['database'] = array
  32. (
  33. # 是否开启mysql自助优化功能,开启后,会记录所有where条件和order的字段,可以方便的在后台进行分析、增加索引,必须安装manage组件
  34. 'opt' => true,
  35. # 是否开启sql自动优化,将sql中的select * 转换为 select a,b形式,将sql中的where条件按照索引从左到右自动排序,必须打开上述的opt选项,数据量大时建议打开。
  36. //'sqlOp' => true,
  37. 'create' => $create,
  38. # 默认数据库配置
  39. 'default' => array
  40. (
  41. 'type' => 'pdo',
  42. 'host' => array
  43. (
  44. 'read' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
  45. 'update' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
  46. 'create' => isset($dc['mysql']) ? $dc['mysql']['host_create'] : 'web-mysql:3306',
  47. ),
  48. 'database' => 'churen',
  49. 'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
  50. 'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
  51. 'charset' => 'utf8mb4',
  52. ),
  53. # 定义历史数据库
  54. 'old' => array
  55. (
  56. 'type' => 'pdo',
  57. 'host' => array
  58. (
  59. 'read' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
  60. 'update' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
  61. 'create' => isset($dc['mysql']) ? $dc['mysql']['host_create'] : 'web-mysql:3306',
  62. ),
  63. 'database' => 'chuzren1yi9liao',
  64. 'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
  65. 'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
  66. 'charset' => 'utf8mb4',
  67. ),
  68. );
  69. # 缓存配置
  70. $config['cache'] = array
  71. (
  72. # 启用mysql数据库缓存,这个缓存是根据表名自动生成,dever::load形式和service的all、one形式均自动支持,无需手动添加
  73. 'mysql' => 0,
  74. # 启用页面缓存 会根据当前的url来生成缓存,相当于页面静态化。
  75. 'html' => 0,
  76. # 启用数据级别缓存 这个缓存是程序员自定义的:Dever::cache('name', 'value', 3600);
  77. 'data' => 0,
  78. # 启用load加载器缓存,一般不加载
  79. 'load' => 0,
  80. # 启用load加载器的远程加载缓存
  81. 'curl' => 0,
  82. # 启用路由缓存
  83. 'route' => 0,
  84. # 缓存精细控制,根据uri来控制,0则无需缓存
  85. 'routeKey' => array
  86. (
  87. ),
  88. # 哪些路由中的参数不参与生成缓存的key
  89. 'routeNoParam' => array
  90. (
  91. 'uid' => array
  92. (
  93. ),
  94. ),
  95. # 缓存清理的参数名,请通过shell=clearcache执行
  96. 'shell' => 'clearcache',
  97. # 是否启用key失效时间记录,启用之后,将会记录每个key的失效时间
  98. 'expire' => true,
  99. # 缓存类型
  100. 'type' => 'redis',//memcache、redis
  101. # 缓存保存方式,支持多个数据源、多台缓存服务器
  102. 'store' => array
  103. (
  104. array
  105. (
  106. 'host' => 'server-redis',
  107. 'port' => '6379',
  108. 'weight' => 100,
  109. 'password' => 'dm_redis_123',
  110. ),
  111. ),
  112. );
  113. $config['debug'] = array
  114. (
  115. 'log' => false
  116. );
  117. /*
  118. if (DEVER_APP_NAME == 'source') {
  119. $config['debug']['log'] = array('type' => 'file');
  120. }
  121. */
  122. $host = 'http://'.$local . '/';
  123. $name = '';
  124. if (isset($dc['mysql'])) {
  125. $name = '';
  126. }
  127. $upload = $host . $name . 'package/';
  128. $uploadcdn = $host . $name . 'data/';
  129. $config['host'] = array
  130. (
  131. 'upload'=> $upload . 'upload/?save',
  132. 'uploadRes' => isset($dc['res']) && $dc['res'] ? $dc['res'] : $uploadcdn . 'upload/',
  133. # 定义接口
  134. 'project' => array
  135. (
  136. 'uploads' => array
  137. (
  138. 'path' => $host. 'churen/package/upload/?',
  139. ),
  140. ),
  141. );
  142. /*
  143. if (!strstr($_SERVER['DOCUMENT_URI'], 'goods')) {
  144. //$config['host']['project']['goods'] = $config['host']['project']['goodss'];
  145. }
  146. */
  147. return $config;