summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-08-04 09:25:37 -0800
committerHarrison Healey <harrisonmhealey@gmail.com>2016-08-04 13:25:37 -0400
commit59d971dc751b0414c5b38c9df4b552e45f5641be (patch)
treed8c39aa5d1fa67d41d89bdd37f699a8e7ca7af36 /utils
parentac90f5b38962c301318fff9118c4556537002941 (diff)
downloadchat-59d971dc751b0414c5b38c9df4b552e45f5641be.tar.gz
chat-59d971dc751b0414c5b38c9df4b552e45f5641be.tar.bz2
chat-59d971dc751b0414c5b38c9df4b552e45f5641be.zip
PLT-2899 adding clustering of app servers (#3682)
* PLT-2899 adding clustering of app servers * PLT-2899 base framework * PLT-2899 HA backend * PLT-2899 Fixing config file * PLT-2899 adding config syncing * PLT-2899 set System console to readonly when clustering enabled. * PLT-2899 Fixing publish API * PLT-2899 fixing strings
Diffstat (limited to 'utils')
-rw-r--r--utils/config.go11
-rw-r--r--utils/license.go1
2 files changed, 9 insertions, 3 deletions
diff --git a/utils/config.go b/utils/config.go
index 868e96b51..a1a6becd1 100644
--- a/utils/config.go
+++ b/utils/config.go
@@ -4,6 +4,7 @@
package utils
import (
+ "crypto/md5"
"encoding/json"
"fmt"
"io/ioutil"
@@ -26,7 +27,7 @@ const (
var Cfg *model.Config = &model.Config{}
var CfgDiagnosticId = ""
-var CfgLastModified int64 = 0
+var CfgHash = ""
var CfgFileName string = ""
var ClientCfg map[string]string = map[string]string{}
@@ -157,11 +158,10 @@ func LoadConfig(fileName string) {
map[string]interface{}{"Filename": fileName, "Error": err.Error()}))
}
- if info, err := file.Stat(); err != nil {
+ if _, err := file.Stat(); err != nil {
panic(T("utils.config.load_config.getting.panic",
map[string]interface{}{"Filename": fileName, "Error": err.Error()}))
} else {
- CfgLastModified = info.ModTime().Unix()
CfgFileName = fileName
}
@@ -185,6 +185,7 @@ func LoadConfig(fileName string) {
}
Cfg = &config
+ CfgHash = fmt.Sprintf("%x", md5.Sum([]byte(Cfg.ToJson())))
RegenerateClientConfig()
// Actions that need to run every time the config is loaded
@@ -298,6 +299,10 @@ func getClientConfig(c *model.Config) map[string]string {
props["SamlLoginButtonText"] = *c.SamlSettings.LoginButtonText
}
+ if *License.Features.Cluster {
+ props["EnableCluster"] = strconv.FormatBool(*c.ClusterSettings.Enable)
+ }
+
if *License.Features.GoogleSSO {
props["EnableSignUpWithGoogle"] = strconv.FormatBool(c.GoogleSettings.Enable)
}
diff --git a/utils/license.go b/utils/license.go
index 971b05912..246cc553e 100644
--- a/utils/license.go
+++ b/utils/license.go
@@ -122,6 +122,7 @@ func getClientLicense(l *model.License) map[string]string {
props["LDAP"] = strconv.FormatBool(*l.Features.LDAP)
props["MFA"] = strconv.FormatBool(*l.Features.MFA)
props["SAML"] = strconv.FormatBool(*l.Features.SAML)
+ props["Cluster"] = strconv.FormatBool(*l.Features.Cluster)
props["GoogleSSO"] = strconv.FormatBool(*l.Features.GoogleSSO)
props["Office365SSO"] = strconv.FormatBool(*l.Features.Office365SSO)
props["Compliance"] = strconv.FormatBool(*l.Features.Compliance)