default.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 = -1;
  12. if (isset($dc['mysql']['create'])) {
  13. $create = -1;
  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. 'create' => isset($dc['mysql']) ? $dc['mysql']['host_create'] : 'web-mysql:3306',
  30. ),
  31. 'database' => 'cms',
  32. 'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
  33. 'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
  34. 'charset' => 'utf8mb4',
  35. ),
  36. );
  37. # 缓存配置
  38. $config['cache'] = array
  39. (
  40. # 启用mysql数据库缓存,这个缓存是根据表名自动生成,dever::load形式和service的all、one形式均自动支持,无需手动添加
  41. 'mysql' => 0,
  42. # 启用页面缓存 会根据当前的url来生成缓存,相当于页面静态化。
  43. 'html' => 0,
  44. # 启用数据级别缓存 这个缓存是程序员自定义的:Dever::cache('name', 'value', 3600);
  45. 'data' => 0,
  46. # 启用load加载器缓存,一般不加载
  47. 'load' => 0,
  48. # 启用load加载器的远程加载缓存
  49. 'curl' => 0,
  50. # 启用路由缓存
  51. 'route' => 0,
  52. # 缓存精细控制,根据uri来控制,0则无需缓存
  53. 'routeKey' => array
  54. (
  55. ),
  56. # 哪些路由中的参数不参与生成缓存的key
  57. 'routeNoParam' => array
  58. (
  59. 'uid' => array
  60. (
  61. ),
  62. ),
  63. # 缓存清理的参数名,请通过shell=clearcache执行
  64. 'shell' => 'clearcache',
  65. # 是否启用key失效时间记录,启用之后,将会记录每个key的失效时间
  66. 'expire' => true,
  67. # 缓存类型
  68. 'type' => 'redis',//memcache、redis
  69. # 缓存保存方式,支持多个数据源、多台缓存服务器
  70. 'store' => array
  71. (
  72. array
  73. (
  74. 'host' => 'server-redis',
  75. 'port' => '6379',
  76. 'weight' => 100,
  77. 'password' => 'dm_redis_123',
  78. ),
  79. ),
  80. );
  81. $config['debug'] = array
  82. (
  83. //不记录文件
  84. 'log' => false,
  85. //日志记录到文件
  86. //array('type' => 'file')
  87. );
  88. $host = 'http://'.$local . '/';
  89. $upload = $host . 'cms/package/';
  90. $uploadcdn = $host . 'cms/data/';
  91. $config['host'] = array
  92. (
  93. 'upload'=> $upload . 'upload/?save',
  94. 'uploadRes' => isset($dc['res']) && $dc['res'] ? $dc['res'] : $uploadcdn . 'upload/',
  95. );
  96. return $config;