rename tls config

This commit is contained in:
杨黄林
2023-09-11 18:09:36 +08:00
parent ef8b65cbf2
commit 7e2f59eba8
2 changed files with 14 additions and 7 deletions

View File

@@ -124,12 +124,17 @@ func ParseConfigFile(file string) (controller.HandleController, server.TLS, erro
common.DashboardUser = commonSection.Key("dashboard_user").Value()
common.DashboardPwd = commonSection.Key("dashboard_pwd").Value()
tls.Enable = commonSection.Key("dashboard_tls_mode").MustBool(false)
tls.Cert = commonSection.Key("dashboard_tls_cert_file").MustString("")
tls.Key = commonSection.Key("dashboard_tls_key_file").MustString("")
tls.Enable = commonSection.Key("tls_mode").MustBool(false)
tls.Cert = commonSection.Key("tls_cert_file").MustString("")
tls.Key = commonSection.Key("tls_key_file").MustString("")
if tls.Enable {
tls.Protocol = "HTTPS"
}
if tls.Enable && (strings.TrimSpace(tls.Cert) == "" || strings.TrimSpace(tls.Key) == "") {
tls.Enable = false
tls.Protocol = "HTTP"
log.Printf("fail to enable tls: tls cert or key not exist, use http as default.")
}
portsSection, err := iniFile.GetSection("ports")
if err != nil {