123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <?php
- # 验证dc是否存在,一般在share目录下
- $dc = array();
- $dc_file = '/data/dm/container/share/dc/config.php';
- if (is_file($dc_file)) {
- $dc = include($dc_file);
- }
- # 基本配置
- $config['base'] = array
- (
- # api文档生成是否开启,开启后,将会根据访问来生成文档。生产环境建议禁止
- 'apiDoc' => false,
- # api日志是否开启,开启后,将会记录所有带有_api后缀方法的请求参数和响应参数
- 'apiLog' => false,
- # 定义自动转为api的目录,可以将该目录下的所有类的公共方法,都转为可以访问的api,开启该功能可能有安全性问题。
- 'apiOpenPath' => 'src',
- # 启用后,将会根据api目录下的配置文件自动定位api
- 'apiConfig' => false,
- );
- if (isset($dc['data'])) {
- $config['base']['data'] = $dc['data'];
- }
- $create = false;
- if (isset($dc['mysql']['create'])) {
- $create = false;
- }
- $create = -1;
- $ip = isset($dc['host']) ? $dc['host'] : '192.168.33.10';
- $local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $ip;
- # 数据库配置
- $config['database'] = array
- (
- # 是否开启mysql自助优化功能,开启后,会记录所有where条件和order的字段,可以方便的在后台进行分析、增加索引,必须安装manage组件
- 'opt' => false,
- # 是否开启sql自动优化,将sql中的select * 转换为 select a,b形式,将sql中的where条件按照索引从左到右自动排序,必须打开上述的opt选项,数据量大时建议打开。
- //'sqlOp' => true,
- 'create' => $create,
- # 默认数据库配置
- 'default' => array
- (
- 'type' => 'pdo',
- 'host' => array
- (
- 'read' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
- 'update' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
- 'create' => isset($dc['mysql']) ? $dc['mysql']['host_create'] : 'web-mysql:3306',
- ),
- 'database' => 'site',
- 'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
- 'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
- 'charset' => 'utf8mb4',
- ),
- );
- # 缓存配置
- $config['cache'] = array
- (
- # 启用mysql数据库缓存,这个缓存是根据表名自动生成,dever::load形式和service的all、one形式均自动支持,无需手动添加
- 'mysql' => 0,
- # 启用页面缓存 会根据当前的url来生成缓存,相当于页面静态化。
- 'html' => 0,
- # 启用数据级别缓存 这个缓存是程序员自定义的:Dever::cache('name', 'value', 3600);
- 'data' => 0,
- # 启用load加载器缓存,一般不加载
- 'load' => 0,
- # 启用load加载器的远程加载缓存
- 'curl' => 0,
- # 启用路由缓存
- 'route' => 0,
- # 缓存精细控制,根据uri来控制,0则无需缓存
- 'routeKey' => array
- (
-
- ),
- # 哪些路由中的参数不参与生成缓存的key
- 'routeNoParam' => array
- (
- 'uid' => array
- (
-
- ),
- ),
-
- # 缓存清理的参数名,请通过shell=clearcache执行
- 'shell' => 'clearcache',
- # 是否启用key失效时间记录,启用之后,将会记录每个key的失效时间
- 'expire' => true,
- # 缓存类型
- 'type' => 'redis',//memcache、redis
- # 缓存保存方式,支持多个数据源、多台缓存服务器
- 'store' => array
- (
- array
- (
- 'host' => 'server-redis',
- 'port' => '6379',
- 'weight' => 100,
- 'password' => 'dm_redis_123',
- ),
- ),
- );
- $config['debug'] = array
- (
- 'log' => false
- );
- /*
- if (DEVER_APP_NAME == 'source') {
- $config['debug']['log'] = array('type' => 'file');
- }
- */
- $host = 'http://'.$local . '/site/';
- $name = '';
- if (isset($dc['mysql'])) {
- $name = '';
- }
- $upload = $host . $name . 'package/';
- $uploadcdn = $host . $name . 'data/';
- $config['host'] = array
- (
- 'upload'=> $upload . 'upload/?save',
- 'uploadRes' => isset($dc['res']) && $dc['res'] ? $dc['res'] : $uploadcdn . 'upload/',
- # 定义接口
- 'project' => array
- (
- 'uploads' => array
- (
- 'path' => $host. 'churen/package/upload/?',
- ),
- ),
- );
- /*
- if (!strstr($_SERVER['DOCUMENT_URI'], 'goods')) {
- //$config['host']['project']['goods'] = $config['host']['project']['goodss'];
- }
- */
- return $config;
|