summaryrefslogtreecommitdiffstats
path: root/api4/system.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-14 13:52:27 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-03-14 08:52:27 -0400
commitd03367c56005470396d883d273323ecbd8d4f243 (patch)
tree921b6e459c367b9172809bc63a218711566b304d /api4/system.go
parentee457176bd0c4442358df089044b87eb75fe7569 (diff)
downloadchat-d03367c56005470396d883d273323ecbd8d4f243.tar.gz
chat-d03367c56005470396d883d273323ecbd8d4f243.tar.bz2
chat-d03367c56005470396d883d273323ecbd8d4f243.zip
Add implementation for POST /config/reload apiV4 - Reload Configuration (#5713)
Diffstat (limited to 'api4/system.go')
-rw-r--r--api4/system.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/api4/system.go b/api4/system.go
index 04275f57f..32c010d82 100644
--- a/api4/system.go
+++ b/api4/system.go
@@ -17,6 +17,7 @@ func InitSystem() {
BaseRoutes.System.Handle("/ping", ApiHandler(getSystemPing)).Methods("GET")
BaseRoutes.ApiRoot.Handle("/config", ApiSessionRequired(getConfig)).Methods("GET")
+ BaseRoutes.ApiRoot.Handle("/config/reload", ApiSessionRequired(configReload)).Methods("POST")
BaseRoutes.ApiRoot.Handle("/email/test", ApiSessionRequired(testEmail)).Methods("POST")
BaseRoutes.ApiRoot.Handle("/database/recycle", ApiSessionRequired(databaseRecycle)).Methods("POST")
}
@@ -53,6 +54,18 @@ func getConfig(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write([]byte(cfg.ToJson()))
}
+func configReload(c *Context, w http.ResponseWriter, r *http.Request) {
+ if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
+ return
+ }
+
+ app.ReloadConfig()
+
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+ ReturnStatusOK(w)
+}
+
func databaseRecycle(c *Context, w http.ResponseWriter, r *http.Request) {
if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {