2017-08-04 08:20:59 +00:00
|
|
|
|
package hotime
|
|
|
|
|
|
2020-02-20 06:20:56 +00:00
|
|
|
|
var IsRun = false //当前状态
|
|
|
|
|
var App = map[string]*Application{} //整个项目
|
2017-08-10 10:14:56 +00:00
|
|
|
|
|
2017-08-04 08:20:59 +00:00
|
|
|
|
//var Db = HoTimeDB{} //数据库实例
|
|
|
|
|
|
|
|
|
|
var Config = Map{
|
2020-02-20 07:06:39 +00:00
|
|
|
|
"debug": 1, //debug 0关闭1开启
|
|
|
|
|
"logLevel": LOG_NIL,
|
|
|
|
|
"dbHost": "127.0.0.1",
|
2017-08-10 10:14:56 +00:00
|
|
|
|
"dbName": "test",
|
|
|
|
|
"dbUser": "root",
|
|
|
|
|
"dbPwd": "root",
|
|
|
|
|
"dbPort": "3306",
|
2020-02-20 06:20:56 +00:00
|
|
|
|
"dbCached": 0, //0不开启缓存
|
2017-08-04 08:20:59 +00:00
|
|
|
|
"cacheShortTime": 60 * 60 * 2,
|
2017-08-10 10:14:56 +00:00
|
|
|
|
"cacheLongTime": 60 * 60 * 24 * 30,
|
2020-02-20 06:20:56 +00:00
|
|
|
|
"error": Map{
|
|
|
|
|
"1": "内部系统异常",
|
|
|
|
|
"2": "访问权限异常",
|
|
|
|
|
"3": "请求参数异常",
|
|
|
|
|
"4": "数据处理异常",
|
|
|
|
|
"5": "数据结果异常",
|
|
|
|
|
},
|
|
|
|
|
"tpt": "tpt",
|
|
|
|
|
"defFile": []string{"index.html", "index.htm"},
|
|
|
|
|
"crossDomain": "", //是否开启跨域
|
|
|
|
|
"modeRouterStrict": false, //路由严格模式/a/b/c
|
|
|
|
|
"port": "0",
|
|
|
|
|
"sessionName": "HOTIME",
|
|
|
|
|
"tlsPort": "0",
|
|
|
|
|
"tlsKey": "",
|
|
|
|
|
"tlsCert": "",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ConfigNote = Map{
|
|
|
|
|
"logLevel": "日志等级,0打印,1关闭,2,记录到文件",
|
|
|
|
|
"debug": "是否开启debug模式,0关闭,其他开启,debug模式下日志展示更全", //debug 0关闭1开启
|
|
|
|
|
"dbHost": "数据库ip地址默认127.0.0.1",
|
|
|
|
|
"dbName": "数据库名称,sqlite为文件路径比如a/x.db",
|
|
|
|
|
"dbUser": "数据库用户名",
|
|
|
|
|
"dbPwd": "数据库密码",
|
|
|
|
|
"dbPort": "数据库端口",
|
|
|
|
|
"dbType": "如果使用自动数据库配置,请设置此项,手动配置数据库不需要,目前支持mysql,sqlite",
|
|
|
|
|
"dbCached": "是否开启数据库缓存0为关闭,其他开启", //0不开启缓存
|
|
|
|
|
"redisHost": "需要使用redis服务时配置,默认服务ip:127.0.0.1",
|
|
|
|
|
"redisPort": "需要使用redis服务时配置,默认服务端口:6379",
|
|
|
|
|
"redisPwd": "需要使用redis服务时配置,默认服务密码:123456",
|
|
|
|
|
"cacheShortTime": "两级缓存,短缓存存储时间60 * 60 * 2,一般为内存缓存",
|
|
|
|
|
"cacheLongTime": "两级缓存,长缓存存储时间60 * 60 * 24 * 30,一般为数据库或者redis缓存",
|
|
|
|
|
"error": Map{
|
|
|
|
|
"1": "内部系统异常,在环境配置,文件访问权限等基础运行环境条件不足造成严重错误时使用",
|
|
|
|
|
"2": "访问权限异常,没有登录或者登录异常等时候使用",
|
|
|
|
|
"3": "请求参数异常,request参数不满足要求,比如参数不足,参数类型错误,参数不满足要求等时候使用",
|
|
|
|
|
"4": "数据处理异常,数据库操作或者三方请求返回的结果非正常结果,比如数据库突然中断等时候使用",
|
|
|
|
|
"5": "数据结果异常,一般用于无法给出response要求的格式要求下使用,比如response需要的是string格式但你只能提供int数据时",
|
|
|
|
|
"注释": "web服务内置错误提示,自定义异常建议10开始",
|
2019-09-14 09:01:45 +00:00
|
|
|
|
},
|
2020-02-20 06:20:56 +00:00
|
|
|
|
"tpt": "静态文件目录,默认为程序目录下tpt目录",
|
|
|
|
|
"defFile": "默认访问文件,默认访问index.html或者index.htm文件",
|
|
|
|
|
"crossDomain": "跨域设置,空字符串为不开启,*为开启所有网站允许跨域,http://www.baidu.com为指定域允许跨域", //是否开启跨域
|
|
|
|
|
"modeRouterStrict": "路由严格模式false,为大小写忽略必须匹配,true必须大小写匹配", //路由严格模式/a/b/c
|
2020-02-20 07:06:39 +00:00
|
|
|
|
"connectLogShow": "web访问链接、访问ip、访问时间打印,0为关闭其他数字开启此功能",
|
2020-02-20 06:20:56 +00:00
|
|
|
|
"sessionName": "设置session的cookie名默认HOTIME",
|
|
|
|
|
"port": "web服务开启Http端口,0为不启用http服务",
|
|
|
|
|
"tlsPort": "web服务https端口,0为不启用https服务",
|
|
|
|
|
"tlsKey": "https密钥",
|
|
|
|
|
"tlsCert": "https证书",
|
2017-08-04 08:20:59 +00:00
|
|
|
|
}
|