add custom dashboard bind address

This commit is contained in:
timerever
2017-11-28 15:56:34 +08:00
parent 0f1005ff61
commit 8c65b337ca
3 changed files with 15 additions and 3 deletions

View File

@ -39,6 +39,7 @@ type ServerCommonConf struct {
// if VhostHttpsPort equals 0, don't listen a public port for https protocol
VhostHttpsPort int64
DashboardAddr string
// if DashboardPort equals 0, dashboard is not available
DashboardPort int64
@ -72,6 +73,7 @@ func GetDefaultServerCommonConf() *ServerCommonConf {
ProxyBindAddr: "0.0.0.0",
VhostHttpPort: 0,
VhostHttpsPort: 0,
DashboardAddr: "0.0.0.0",
DashboardPort: 0,
DashboardUser: "admin",
DashboardPwd: "admin",
@ -158,6 +160,13 @@ func LoadServerCommonConf(conf ini.File) (cfg *ServerCommonConf, err error) {
cfg.VhostHttpsPort = 0
}
tmpStr, ok = conf.Get("common", "dashboard_addr")
if ok {
cfg.DashboardAddr = tmpStr
} else {
cfg.DashboardAddr = cfg.BindAddr
}
tmpStr, ok = conf.Get("common", "dashboard_port")
if ok {
cfg.DashboardPort, err = strconv.ParseInt(tmpStr, 10, 64)