fix(fix4): enforce runtime contract and orchestrator guardrails
This commit is contained in:
@@ -15,26 +15,6 @@ import (
|
||||
)
|
||||
|
||||
func UpdateConfig(key string, value string) error {
|
||||
if key == constant.Hysteria2Enable {
|
||||
if value == "1" {
|
||||
hysteria2Config, err := GetHysteria2Config()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if hysteria2Config.Listen == nil || *hysteria2Config.Listen == "" {
|
||||
logrus.Errorf("hysteria2 config is empty")
|
||||
return errors.New("hysteria2 config is empty")
|
||||
}
|
||||
// Запуск Hysteria2
|
||||
if err = StartHysteria2(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := StopHysteria2(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return dao.UpdateConfig([]string{key}, map[string]interface{}{"value": value})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user