Skip to content

Commit ec6d6d8

Browse files
authored
config: add option to disable panel config updates (#162)
1 parent 4d9fee3 commit ec6d6d8

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

config/config.go

+3
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ type Configuration struct {
319319
// is only required by users running Wings without SSL certificates and using internal IP
320320
// addresses in order to connect. Most users should NOT enable this setting.
321321
AllowCORSPrivateNetwork bool `json:"allow_cors_private_network" yaml:"allow_cors_private_network"`
322+
323+
// IgnorePanelConfigUpdates causes confiuration updates that are sent by the panel to be ignored.
324+
IgnorePanelConfigUpdates bool `json:"ignore_panel_config_updates" yaml:"ignore_panel_config_updates"`
322325
}
323326

324327
// NewAtPath creates a new struct and set the path where it should be stored.

router/router_system.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,21 @@ func postCreateServer(c *gin.Context) {
113113
c.Status(http.StatusAccepted)
114114
}
115115

116+
type postUpdateConfigurationResponse struct {
117+
Applied bool `json:"applied"`
118+
}
119+
116120
// Updates the running configuration for this Wings instance.
117121
func postUpdateConfiguration(c *gin.Context) {
118122
cfg := config.Get()
123+
124+
if cfg.IgnorePanelConfigUpdates {
125+
c.JSON(http.StatusOK, postUpdateConfigurationResponse{
126+
Applied: false,
127+
})
128+
return
129+
}
130+
119131
if err := c.BindJSON(&cfg); err != nil {
120132
return
121133
}
@@ -139,5 +151,7 @@ func postUpdateConfiguration(c *gin.Context) {
139151
// Since we wrote it to the disk successfully now update the global configuration
140152
// state to use this new configuration struct.
141153
config.Set(cfg)
142-
c.Status(http.StatusNoContent)
154+
c.JSON(http.StatusOK, postUpdateConfigurationResponse{
155+
Applied: true,
156+
})
143157
}

0 commit comments

Comments
 (0)