// Handles the reloading and persisting of the Haproxy config after a successful mutation of the // config object. func HandleReload(c *gin.Context, config *haproxy.Config, status int, message gin.H) { runtime := c.MustGet("haRuntime").(*haproxy.Runtime) err := config.RenderAndPersist() if err != nil { HandleError(c, &haproxy.Error{http.StatusInternalServerError, errors.New("Error rendering config file")}) return } err = runtime.Reload(config) if err != nil { HandleError(c, &haproxy.Error{http.StatusInternalServerError, errors.New("Error reloading the HAproxy configuration")}) return } HandleSucces(c, status, message) }