diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-08-13 13:01:21 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-08-13 13:01:21 -0400 |
commit | ca919538cc402ed90ce42ffc3ef98994bb1081f4 (patch) | |
tree | 4ebc16d9c3092fbcf25dba68153868f8d277b0e0 /api | |
parent | d35065d6fd8237468ee3aa63bfba3b2aa29bc4af (diff) | |
download | chat-ca919538cc402ed90ce42ffc3ef98994bb1081f4.tar.gz chat-ca919538cc402ed90ce42ffc3ef98994bb1081f4.tar.bz2 chat-ca919538cc402ed90ce42ffc3ef98994bb1081f4.zip |
Added ConfigStore that is populated from the server
Diffstat (limited to 'api')
-rw-r--r-- | api/config.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/api/config.go b/api/config.go index 91097b4a1..d8d52ca67 100644 --- a/api/config.go +++ b/api/config.go @@ -5,7 +5,9 @@ package api import ( l4g "code.google.com/p/log4go" + "encoding/json" "github.com/gorilla/mux" + "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" "net/http" "strconv" @@ -15,9 +17,23 @@ func InitConfig(r *mux.Router) { l4g.Debug("Initializing config api routes") sr := r.PathPrefix("/config").Subrouter() + sr.Handle("/get_all", ApiAppHandler(getConfig)).Methods("GET") sr.Handle("/get/bypass_email", ApiAppHandler(getBypassEmail)).Methods("GET") } +func getConfig(c *Context, w http.ResponseWriter, r *http.Request) { + settings := make(map[string]string) + + settings["ByPassEmail"] = strconv.FormatBool(utils.Cfg.EmailSettings.ByPassEmail) + + if bytes, err := json.Marshal(settings); err != nil { + c.Err = model.NewAppError("getConfig", "Unable to marshall configuration data", err.Error()) + return + } else { + w.Write(bytes) + } +} + func getBypassEmail(c *Context, w http.ResponseWriter, r *http.Request) { w.Write([]byte(strconv.FormatBool(utils.Cfg.EmailSettings.ByPassEmail))) } |