fix(settings): fill support for additional configuration options
This commit is contained in:
@@ -115,6 +115,50 @@ func SetSettingsHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
if v, ok := value.(float64); ok {
|
if v, ok := value.(float64); ok {
|
||||||
global.CurrentConfig.ListenPort = fmt.Sprintf("%d", int(v))
|
global.CurrentConfig.ListenPort = fmt.Sprintf("%d", int(v))
|
||||||
}
|
}
|
||||||
|
case "FrpcPath":
|
||||||
|
if v, ok := value.(string); ok {
|
||||||
|
global.CurrentConfig.FrpcPath = v
|
||||||
|
}
|
||||||
|
case "InstancePath":
|
||||||
|
if v, ok := value.(string); ok {
|
||||||
|
global.CurrentConfig.InstancePath = v
|
||||||
|
}
|
||||||
|
case "Debug":
|
||||||
|
if v, ok := value.(bool); ok {
|
||||||
|
global.CurrentConfig.Debug = v
|
||||||
|
}
|
||||||
|
case "Watchdog.Enabled":
|
||||||
|
if v, ok := value.(bool); ok {
|
||||||
|
global.CurrentConfig.Watchdog.Enabled = v
|
||||||
|
}
|
||||||
|
case "Watchdog.Port":
|
||||||
|
if v, ok := value.(float64); ok {
|
||||||
|
global.CurrentConfig.Watchdog.Port = int(v)
|
||||||
|
}
|
||||||
|
case "Notification.Enabled":
|
||||||
|
if v, ok := value.(bool); ok {
|
||||||
|
global.CurrentConfig.Notification.Enabled = v
|
||||||
|
}
|
||||||
|
case "Notification.Method":
|
||||||
|
if v, ok := value.(string); ok {
|
||||||
|
global.CurrentConfig.Notification.Method = v
|
||||||
|
}
|
||||||
|
case "Webhook.Method":
|
||||||
|
if v, ok := value.(string); ok {
|
||||||
|
global.CurrentConfig.Webhook.Method = v
|
||||||
|
}
|
||||||
|
case "Webhook.URL":
|
||||||
|
if v, ok := value.(string); ok {
|
||||||
|
global.CurrentConfig.Webhook.URL = v
|
||||||
|
}
|
||||||
|
case "Webhook.Headers":
|
||||||
|
if v, ok := value.(string); ok {
|
||||||
|
global.CurrentConfig.Webhook.Headers = v
|
||||||
|
}
|
||||||
|
case "Webhook.Body":
|
||||||
|
if v, ok := value.(string); ok {
|
||||||
|
global.CurrentConfig.Webhook.Body = v
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
postLog.Warning(fmt.Sprintf("[SetSettingsHandler] Unknown setting key: %s", key))
|
postLog.Warning(fmt.Sprintf("[SetSettingsHandler] Unknown setting key: %s", key))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user