forked from golang/hotime
修复配置bug
This commit is contained in:
parent
adfb2236dc
commit
a8d78832df
@ -7,6 +7,7 @@ import (
|
|||||||
. "code.hoteas.com/golang/hotime/db"
|
. "code.hoteas.com/golang/hotime/db"
|
||||||
. "code.hoteas.com/golang/hotime/log"
|
. "code.hoteas.com/golang/hotime/log"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -237,10 +238,8 @@ func (that *Application) SetConfig(configPath ...string) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
that.Log = GetLog(that.Config.GetString("logFile"), true)
|
if that.Error.GetError() != nil {
|
||||||
that.Error = Error{Logger: that.Log}
|
fmt.Println(that.Error.GetError().Error())
|
||||||
if that.Config.Get("webConnectLogShow") == nil || that.Config.GetBool("webConnectLogShow") {
|
|
||||||
that.WebConnectLog = GetLog(that.Config.GetString("webConnectLogFile"), false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//文件如果损坏则不写入配置防止配置文件数据丢失
|
//文件如果损坏则不写入配置防止配置文件数据丢失
|
||||||
@ -267,6 +266,12 @@ func (that *Application) SetConfig(configPath ...string) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
that.Log = GetLog(that.Config.GetString("logFile"), true)
|
||||||
|
that.Error = Error{Logger: that.Log}
|
||||||
|
if that.Config.Get("webConnectLogShow") == nil || that.Config.GetBool("webConnectLogShow") {
|
||||||
|
that.WebConnectLog = GetLog(that.Config.GetString("webConnectLogFile"), false)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetConnectListener 连接判断,返回false继续传输至控制层,true则停止传输
|
// SetConnectListener 连接判断,返回false继续传输至控制层,true则停止传输
|
||||||
|
@ -8,6 +8,14 @@ var Config = Map{
|
|||||||
"name": "HoTimeDashBoard",
|
"name": "HoTimeDashBoard",
|
||||||
//"id": "2f92h3herh23rh2y8",
|
//"id": "2f92h3herh23rh2y8",
|
||||||
"label": "HoTime管理平台",
|
"label": "HoTime管理平台",
|
||||||
|
"labelConfig": Map{
|
||||||
|
"show": "开启",
|
||||||
|
"add": "添加",
|
||||||
|
"delete": "删除",
|
||||||
|
"edit": "编辑",
|
||||||
|
"info": "查看详情",
|
||||||
|
"download": "下载清单",
|
||||||
|
},
|
||||||
"menus": []Map{
|
"menus": []Map{
|
||||||
//{"label": "平台首页", "name": "HelloWorld", "icon": "el-icon-s-home"},
|
//{"label": "平台首页", "name": "HelloWorld", "icon": "el-icon-s-home"},
|
||||||
//{"label": "测试表格", "table": "table", "icon": "el-icon-suitcase"},
|
//{"label": "测试表格", "table": "table", "icon": "el-icon-suitcase"},
|
||||||
|
@ -23,12 +23,13 @@
|
|||||||
],
|
],
|
||||||
"db": {
|
"db": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"host": "192.168.6.253",
|
"host": "192.168.2.20",
|
||||||
"name": "dgs-cms",
|
"name": "gov_crawler",
|
||||||
"password": "dasda8454456",
|
"password": "fh22y8b882d",
|
||||||
"port": "3306",
|
"port": "3306",
|
||||||
|
"prefix": "",
|
||||||
"user": "root"
|
"user": "root"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"defFile": [
|
"defFile": [
|
||||||
"index.html",
|
"index.html",
|
||||||
|
49
example/config/config1.json
Normal file
49
example/config/config1.json
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"cache": {
|
||||||
|
"db": {
|
||||||
|
"db": false,
|
||||||
|
"session": true,
|
||||||
|
"timeout": 7200
|
||||||
|
},
|
||||||
|
"memory": {
|
||||||
|
"db": true,
|
||||||
|
"session": true,
|
||||||
|
"timeout": 7200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"codeConfig": [
|
||||||
|
{
|
||||||
|
"config": "config/admin.json",
|
||||||
|
"configDB": "config/adminDB.json",
|
||||||
|
"mode": 0,
|
||||||
|
"name": "",
|
||||||
|
"rule": "config/rule.json",
|
||||||
|
"table": "admin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"db": {
|
||||||
|
"mysql": {
|
||||||
|
"host": "192.168.2.20",
|
||||||
|
"name": "gov_crawler",
|
||||||
|
"password": "fh22y8b882d",
|
||||||
|
"port": "3306",
|
||||||
|
"prefix": "",
|
||||||
|
"user": "root"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defFile": [
|
||||||
|
"index.html",
|
||||||
|
"index.htm"
|
||||||
|
],
|
||||||
|
"error": {
|
||||||
|
"1": "内部系统异常",
|
||||||
|
"2": "访问权限异常",
|
||||||
|
"3": "请求参数异常",
|
||||||
|
"4": "数据处理异常",
|
||||||
|
"5": "数据结果异常"
|
||||||
|
},
|
||||||
|
"mode": 2,
|
||||||
|
"port": "8081",
|
||||||
|
"sessionName": "HOTIME",
|
||||||
|
"tpt": "tpt"
|
||||||
|
}
|
@ -94,6 +94,9 @@ func findCaller(skip int) string {
|
|||||||
if file == "code/makecode.go" {
|
if file == "code/makecode.go" {
|
||||||
file, line = getCaller(skip + i + j)
|
file, line = getCaller(skip + i + j)
|
||||||
}
|
}
|
||||||
|
if strings.Index(file, "common/") == 0 {
|
||||||
|
file, line = getCaller(skip + i + j)
|
||||||
|
}
|
||||||
if strings.Contains(file, "application.go") {
|
if strings.Contains(file, "application.go") {
|
||||||
file, line = getCaller(skip + i + j)
|
file, line = getCaller(skip + i + j)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user