add CfgBe/CfgNot function to conf package

pull/193/head
Michael Li 2 years ago
parent 0e4f4e0eee
commit ebcf2be179

@ -112,13 +112,33 @@ func Cfg(key string) (string, bool) {
} }
// CfgIf check expression is true. if expression just have a string like // CfgIf check expression is true. if expression just have a string like
// `Sms` is mean `Sms` whether define in suite feature settings. expression like // `Sms` is mean `Sms` whether defined in suite feature settings. expression like
// `Sms = SmsJuhe` is mean whether `Sms` define in suite feature settings and value // `Sms = SmsJuhe` is mean whether `Sms` define in suite feature settings and value
// is `SmsJuhe` // is `SmsJuhe`
func CfgIf(expression string) bool { func CfgIf(expression string) bool {
return features.CfgIf(expression) return features.CfgIf(expression)
} }
// CfgBe check expression is true then do the handle. if expression just have a string like
// `Sms` is mean `Sms` whether defined in suite feature settings. expression like
// `Sms = SmsJuhe` is mean whether `Sms` define in suite feature settings and value
// is `SmsJuhe`
func CfgBe(expression string, handle func()) {
if features.CfgIf(expression) {
handle()
}
}
// CfgNot check expression is not true then do the handle. if expression just have a string like
// `Sms` is mean `Sms` whether defined in suite feature settings. expression like
// `Sms = SmsJuhe` is mean whether `Sms` define in suite feature settings and value
// is `SmsJuhe`
func CfgNot(expression string, handle func()) {
if !features.CfgIf(expression) {
handle()
}
}
func GetOssDomain() string { func GetOssDomain() string {
uri := "https://" uri := "https://"
if CfgIf("AliOSS") { if CfgIf("AliOSS") {

Loading…
Cancel
Save