配置初始化时增加context参数

This commit is contained in:
GoEdgeLab
2023-03-18 22:12:22 +08:00
parent cfda4857c9
commit 7c0412755b
12 changed files with 15 additions and 15 deletions

View File

@@ -82,7 +82,7 @@ func (this *IndexAction) RunGet(params struct{}) {
this.ErrorPage(err)
return
}
_ = httpsConfig.Init()
_ = httpsConfig.Init(nil)
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 {
restAccessAddrs = append(restAccessAddrs, httpsConfig.FullAddresses()...)
}

View File

@@ -118,7 +118,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
// 校验
certConfig.IsCA = params.IsCA
err = certConfig.Init()
err = certConfig.Init(nil)
if err != nil {
if params.IsCA {
this.Fail("证书校验错误:" + err.Error())

View File

@@ -85,7 +85,7 @@ func (this *UploadPopupAction) RunPost(params struct {
CertData: certData,
KeyData: keyData,
}
err := certConfig.Init()
err := certConfig.Init(nil)
if err != nil {
if params.IsCA {
this.Fail("证书校验错误:" + err.Error())

View File

@@ -65,14 +65,14 @@ func (this *SettingAction) RunPost(params struct {
// TODO 校验配置
reverseProxyConfig := &serverconfigs.ReverseProxyConfig{}
var reverseProxyConfig = &serverconfigs.ReverseProxyConfig{}
err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
if err != nil {
this.ErrorPage(err)
return
}
err = reverseProxyConfig.Init()
err = reverseProxyConfig.Init(nil)
if err != nil {
this.Fail("配置校验失败:" + err.Error())
}

View File

@@ -65,14 +65,14 @@ func (this *SettingAction) RunPost(params struct {
// TODO 校验配置
reverseProxyConfig := &serverconfigs.ReverseProxyConfig{}
var reverseProxyConfig = &serverconfigs.ReverseProxyConfig{}
err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
if err != nil {
this.ErrorPage(err)
return
}
err = reverseProxyConfig.Init()
err = reverseProxyConfig.Init(nil)
if err != nil {
this.Fail("配置校验失败:" + err.Error())
}

View File

@@ -72,7 +72,7 @@ func (this *SettingAction) RunPost(params struct {
return
}
err = reverseProxyConfig.Init()
err = reverseProxyConfig.Init(nil)
if err != nil {
this.Fail("配置校验失败:" + err.Error())
}

View File

@@ -53,7 +53,7 @@ func (this *IndexAction) RunGet(params struct {
this.ErrorPage(err)
return
}
_ = httpsConfig.Init()
_ = httpsConfig.Init(nil)
for _, port := range httpsConfig.AllPorts() {
if lists.ContainsInt(httpPorts, port) {
conflictingPorts = append(conflictingPorts, port)

View File

@@ -43,7 +43,7 @@ func (this *IndexAction) RunGet(params struct {
httpsConfig.IsOn = true
}
_ = httpsConfig.Init()
_ = httpsConfig.Init(nil)
var httpsPorts = httpsConfig.AllPorts()
// 检查http和https端口冲突

View File

@@ -22,7 +22,7 @@ func FindLocationConfig(parentAction *actionutils.ParentAction, locationId int64
return
}
err = locationConfig.Init()
err = locationConfig.Init(nil)
if err != nil {
parentAction.ErrorPage(err)
return

View File

@@ -56,14 +56,14 @@ func (this *SettingAction) RunPost(params struct {
// TODO 校验配置
reverseProxyConfig := &serverconfigs.ReverseProxyConfig{}
var reverseProxyConfig = &serverconfigs.ReverseProxyConfig{}
err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
if err != nil {
this.ErrorPage(err)
return
}
err = reverseProxyConfig.Init()
err = reverseProxyConfig.Init(nil)
if err != nil {
this.Fail("配置校验失败:" + err.Error())
}

View File

@@ -62,7 +62,7 @@ func (this *SettingAction) RunPost(params struct {
return
}
err = reverseProxyConfig.Init()
err = reverseProxyConfig.Init(nil)
if err != nil {
this.Fail("配置校验失败:" + err.Error())
}

View File

@@ -47,7 +47,7 @@ func (this *UpdateHTTPSPopupAction) RunGet(params struct{}) {
CertData: certData,
KeyData: keyData,
}
_ = certConfig.Init()
_ = certConfig.Init(nil)
certConfig.CertData = nil
certConfig.KeyData = nil
certConfigs = append(certConfigs, certConfig)