mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 12:20:27 +08:00
增加请求脚本审核机制
This commit is contained in:
@@ -29,3 +29,14 @@ func (this *HTTPRequestScriptsConfig) IsEmpty() bool {
|
||||
return (this.InitGroup == nil || this.InitGroup.IsEmpty()) &&
|
||||
(this.RequestGroup == nil || this.RequestGroup.IsEmpty())
|
||||
}
|
||||
|
||||
func (this *HTTPRequestScriptsConfig) AllGroups() []*ScriptGroupConfig {
|
||||
var result []*ScriptGroupConfig
|
||||
if this.InitGroup != nil {
|
||||
result = append(result, this.InitGroup)
|
||||
}
|
||||
if this.RequestGroup != nil {
|
||||
result = append(result, this.RequestGroup)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -2,13 +2,36 @@
|
||||
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
stringutil "github.com/iwind/TeaGo/utils/string"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ScriptConfig struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
|
||||
Code string `yaml:"code" json:"code"`
|
||||
Code string `yaml:"code" json:"code"` // 当前运行的代码
|
||||
AuditingCode string `yaml:"auditingCode" json:"auditingCode"` // 审核中的代码
|
||||
AuditingCodeMD5 string `yaml:"auditingCodeMD5" json:"auditingCodeMD5"` // 审核中的代码MD5
|
||||
|
||||
realCode string
|
||||
}
|
||||
|
||||
func (this *ScriptConfig) Init() error {
|
||||
this.realCode = this.TrimCode()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *ScriptConfig) TrimCode() string {
|
||||
return strings.TrimSpace(this.Code)
|
||||
}
|
||||
|
||||
func (this *ScriptConfig) RealCode() string {
|
||||
return this.realCode
|
||||
}
|
||||
|
||||
func (this *ScriptConfig) CodeMD5() string {
|
||||
return stringutil.Md5(this.TrimCode())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user