summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-08-14 08:48:24 -0400
committerChristopher Speller <crspeller@gmail.com>2015-08-14 08:48:24 -0400
commit92c4df5b109ac8b15f6384a5c027024696bbd4d8 (patch)
tree41a18a9bcbbcc7cd961cc424878ac37aade5c288 /api
parenta8930cbabec21635a10e8cac4d2c0c79867f283d (diff)
parent8fc4456213c5ee16863b7f1bcb20e35a19469a1d (diff)
downloadchat-92c4df5b109ac8b15f6384a5c027024696bbd4d8.tar.gz
chat-92c4df5b109ac8b15f6384a5c027024696bbd4d8.tar.bz2
chat-92c4df5b109ac8b15f6384a5c027024696bbd4d8.zip
Merge pull request #370 from hmhealey/mm1812
MM-1812 Provide warnings on team invite screens when email is disabled
Diffstat (limited to 'api')
-rw-r--r--api/api.go1
-rw-r--r--api/config.go34
2 files changed, 35 insertions, 0 deletions
diff --git a/api/api.go b/api/api.go
index 2ea27ed9f..9770930f7 100644
--- a/api/api.go
+++ b/api/api.go
@@ -40,6 +40,7 @@ func InitApi() {
InitWebSocket(r)
InitFile(r)
InitCommand(r)
+ InitConfig(r)
templatesDir := utils.FindDir("api/templates")
l4g.Debug("Parsing server templates at %v", templatesDir)
diff --git a/api/config.go b/api/config.go
new file mode 100644
index 000000000..142d1ca66
--- /dev/null
+++ b/api/config.go
@@ -0,0 +1,34 @@
+// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+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"
+)
+
+func InitConfig(r *mux.Router) {
+ l4g.Debug("Initializing config api routes")
+
+ sr := r.PathPrefix("/config").Subrouter()
+ sr.Handle("/get_all", ApiAppHandler(getConfig)).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)
+ }
+}