2015-10-08 12:27:09 -04:00
|
|
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
2015-06-14 23:53:32 -08:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
package utils
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
2015-09-15 18:59:14 -07:00
|
|
|
"fmt"
|
2015-09-17 21:00:59 -07:00
|
|
|
"io/ioutil"
|
2015-06-14 23:53:32 -08:00
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
2015-09-15 18:59:14 -07:00
|
|
|
"strconv"
|
|
|
|
|
|
2016-01-11 09:12:51 -06:00
|
|
|
l4g "github.com/alecthomas/log4go"
|
2015-09-17 21:00:59 -07:00
|
|
|
|
2016-04-06 08:19:56 -04:00
|
|
|
"github.com/mattermost/platform/einterfaces"
|
2015-09-17 21:00:59 -07:00
|
|
|
"github.com/mattermost/platform/model"
|
2015-06-14 23:53:32 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
2015-09-10 18:32:22 -07:00
|
|
|
MODE_DEV = "dev"
|
|
|
|
|
MODE_BETA = "beta"
|
|
|
|
|
MODE_PROD = "prod"
|
|
|
|
|
LOG_ROTATE_SIZE = 10000
|
2015-06-14 23:53:32 -08:00
|
|
|
)
|
|
|
|
|
|
2015-09-17 21:00:59 -07:00
|
|
|
var Cfg *model.Config = &model.Config{}
|
2015-11-30 22:38:38 -08:00
|
|
|
var CfgDiagnosticId = ""
|
2015-09-15 18:59:14 -07:00
|
|
|
var CfgLastModified int64 = 0
|
2015-09-17 21:00:59 -07:00
|
|
|
var CfgFileName string = ""
|
2015-10-16 09:10:54 -07:00
|
|
|
var ClientCfg map[string]string = map[string]string{}
|
2015-06-14 23:53:32 -08:00
|
|
|
|
2015-09-04 11:59:10 -07:00
|
|
|
func FindConfigFile(fileName string) string {
|
2016-05-19 12:56:00 -04:00
|
|
|
if _, err := os.Stat("./config/" + fileName); err == nil {
|
2015-06-14 23:53:32 -08:00
|
|
|
fileName, _ = filepath.Abs("./config/" + fileName)
|
|
|
|
|
} else if _, err := os.Stat("../config/" + fileName); err == nil {
|
|
|
|
|
fileName, _ = filepath.Abs("../config/" + fileName)
|
|
|
|
|
} else if _, err := os.Stat(fileName); err == nil {
|
|
|
|
|
fileName, _ = filepath.Abs(fileName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fileName
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func FindDir(dir string) string {
|
|
|
|
|
fileName := "."
|
|
|
|
|
if _, err := os.Stat("./" + dir + "/"); err == nil {
|
|
|
|
|
fileName, _ = filepath.Abs("./" + dir + "/")
|
|
|
|
|
} else if _, err := os.Stat("../" + dir + "/"); err == nil {
|
|
|
|
|
fileName, _ = filepath.Abs("../" + dir + "/")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fileName + "/"
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-21 22:37:01 -07:00
|
|
|
func DisableDebugLogForTest() {
|
|
|
|
|
l4g.Global["stdout"].Level = l4g.WARNING
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func EnableDebugLogForTest() {
|
|
|
|
|
l4g.Global["stdout"].Level = l4g.DEBUG
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-04 11:59:10 -07:00
|
|
|
func ConfigureCmdLineLog() {
|
2015-09-17 21:00:59 -07:00
|
|
|
ls := model.LogSettings{}
|
2015-09-22 12:12:50 -07:00
|
|
|
ls.EnableConsole = true
|
2015-11-16 17:12:49 -08:00
|
|
|
ls.ConsoleLevel = "WARN"
|
2015-09-10 18:32:22 -07:00
|
|
|
configureLog(&ls)
|
2015-09-04 11:59:10 -07:00
|
|
|
}
|
|
|
|
|
|
2015-09-17 21:00:59 -07:00
|
|
|
func configureLog(s *model.LogSettings) {
|
2015-06-14 23:53:32 -08:00
|
|
|
|
|
|
|
|
l4g.Close()
|
|
|
|
|
|
2015-09-22 12:12:50 -07:00
|
|
|
if s.EnableConsole {
|
2015-06-14 23:53:32 -08:00
|
|
|
level := l4g.DEBUG
|
|
|
|
|
if s.ConsoleLevel == "INFO" {
|
|
|
|
|
level = l4g.INFO
|
2015-11-16 17:12:49 -08:00
|
|
|
} else if s.ConsoleLevel == "WARN" {
|
|
|
|
|
level = l4g.WARNING
|
2015-06-14 23:53:32 -08:00
|
|
|
} else if s.ConsoleLevel == "ERROR" {
|
|
|
|
|
level = l4g.ERROR
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-11 09:12:51 -06:00
|
|
|
lw := l4g.NewConsoleLogWriter()
|
|
|
|
|
lw.SetFormat("[%D %T] [%L] %M")
|
|
|
|
|
l4g.AddFilter("stdout", level, lw)
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
2015-09-22 12:12:50 -07:00
|
|
|
if s.EnableFile {
|
2015-06-14 23:53:32 -08:00
|
|
|
|
2015-09-17 21:00:59 -07:00
|
|
|
var fileFormat = s.FileFormat
|
|
|
|
|
|
|
|
|
|
if fileFormat == "" {
|
|
|
|
|
fileFormat = "[%D %T] [%L] %M"
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
level := l4g.DEBUG
|
|
|
|
|
if s.FileLevel == "INFO" {
|
|
|
|
|
level = l4g.INFO
|
2015-11-16 17:12:49 -08:00
|
|
|
} else if s.FileLevel == "WARN" {
|
|
|
|
|
level = l4g.WARNING
|
2015-06-14 23:53:32 -08:00
|
|
|
} else if s.FileLevel == "ERROR" {
|
|
|
|
|
level = l4g.ERROR
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-17 21:00:59 -07:00
|
|
|
flw := l4g.NewFileLogWriter(GetLogFileLocation(s.FileLocation), false)
|
|
|
|
|
flw.SetFormat(fileFormat)
|
2015-06-14 23:53:32 -08:00
|
|
|
flw.SetRotate(true)
|
2015-09-10 18:32:22 -07:00
|
|
|
flw.SetRotateLines(LOG_ROTATE_SIZE)
|
2015-06-14 23:53:32 -08:00
|
|
|
l4g.AddFilter("file", level, flw)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-17 21:00:59 -07:00
|
|
|
func GetLogFileLocation(fileLocation string) string {
|
|
|
|
|
if fileLocation == "" {
|
|
|
|
|
return FindDir("logs") + "mattermost.log"
|
|
|
|
|
} else {
|
|
|
|
|
return fileLocation
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func SaveConfig(fileName string, config *model.Config) *model.AppError {
|
|
|
|
|
b, err := json.MarshalIndent(config, "", " ")
|
|
|
|
|
if err != nil {
|
2016-01-25 00:49:19 -03:00
|
|
|
return model.NewLocAppError("SaveConfig", "utils.config.save_config.saving.app_error",
|
|
|
|
|
map[string]interface{}{"Filename": fileName}, err.Error())
|
2015-09-17 21:00:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err = ioutil.WriteFile(fileName, b, 0644)
|
|
|
|
|
if err != nil {
|
2016-01-25 00:49:19 -03:00
|
|
|
return model.NewLocAppError("SaveConfig", "utils.config.save_config.saving.app_error",
|
|
|
|
|
map[string]interface{}{"Filename": fileName}, err.Error())
|
2015-09-17 21:00:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-14 23:53:32 -08:00
|
|
|
// LoadConfig will try to search around for the corresponding config file.
|
|
|
|
|
// It will search /tmp/fileName then attempt ./config/fileName,
|
|
|
|
|
// then ../config/fileName and last it will look at fileName
|
|
|
|
|
func LoadConfig(fileName string) {
|
|
|
|
|
|
2015-09-04 11:59:10 -07:00
|
|
|
fileName = FindConfigFile(fileName)
|
2015-06-14 23:53:32 -08:00
|
|
|
|
|
|
|
|
file, err := os.Open(fileName)
|
|
|
|
|
if err != nil {
|
2016-01-25 00:49:19 -03:00
|
|
|
panic(T("utils.config.load_config.opening.panic",
|
|
|
|
|
map[string]interface{}{"Filename": fileName, "Error": err.Error()}))
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
decoder := json.NewDecoder(file)
|
2015-09-17 21:00:59 -07:00
|
|
|
config := model.Config{}
|
2015-06-14 23:53:32 -08:00
|
|
|
err = decoder.Decode(&config)
|
|
|
|
|
if err != nil {
|
2016-01-25 00:49:19 -03:00
|
|
|
panic(T("utils.config.load_config.decoding.panic",
|
|
|
|
|
map[string]interface{}{"Filename": fileName, "Error": err.Error()}))
|
2015-06-17 11:50:51 -04:00
|
|
|
}
|
|
|
|
|
|
2015-09-15 18:59:14 -07:00
|
|
|
if info, err := file.Stat(); err != nil {
|
2016-01-25 00:49:19 -03:00
|
|
|
panic(T("utils.config.load_config.getting.panic",
|
|
|
|
|
map[string]interface{}{"Filename": fileName, "Error": err.Error()}))
|
2015-09-15 18:59:14 -07:00
|
|
|
} else {
|
|
|
|
|
CfgLastModified = info.ModTime().Unix()
|
2015-09-17 21:00:59 -07:00
|
|
|
CfgFileName = fileName
|
2015-09-15 18:59:14 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-09 12:24:39 -07:00
|
|
|
config.SetDefaults()
|
|
|
|
|
|
2015-09-29 14:17:16 -07:00
|
|
|
if err := config.IsValid(); err != nil {
|
2016-01-25 00:49:19 -03:00
|
|
|
panic(T("utils.config.load_config.validating.panic",
|
|
|
|
|
map[string]interface{}{"Filename": fileName, "Error": err.Message}))
|
2015-09-29 14:17:16 -07:00
|
|
|
}
|
|
|
|
|
|
2016-04-06 08:19:56 -04:00
|
|
|
if err := ValidateLdapFilter(&config); err != nil {
|
|
|
|
|
panic(T("utils.config.load_config.validating.panic",
|
|
|
|
|
map[string]interface{}{"Filename": fileName, "Error": err.Message}))
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-10 18:32:22 -07:00
|
|
|
configureLog(&config.LogSettings)
|
2015-09-29 11:59:26 -07:00
|
|
|
TestConnection(&config)
|
2015-06-14 23:53:32 -08:00
|
|
|
|
2015-10-26 17:09:15 +05:30
|
|
|
if config.FileSettings.DriverName == model.IMAGE_DRIVER_LOCAL {
|
|
|
|
|
dir := config.FileSettings.Directory
|
|
|
|
|
if len(dir) > 0 && dir[len(dir)-1:] != "/" {
|
|
|
|
|
config.FileSettings.Directory += "/"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-14 23:53:32 -08:00
|
|
|
Cfg = &config
|
2015-10-16 09:10:54 -07:00
|
|
|
ClientCfg = getClientConfig(Cfg)
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
2015-10-16 09:10:54 -07:00
|
|
|
func getClientConfig(c *model.Config) map[string]string {
|
2015-09-15 18:59:14 -07:00
|
|
|
props := make(map[string]string)
|
|
|
|
|
|
2015-09-17 13:01:40 -07:00
|
|
|
props["Version"] = model.CurrentVersion
|
|
|
|
|
props["BuildNumber"] = model.BuildNumber
|
|
|
|
|
props["BuildDate"] = model.BuildDate
|
|
|
|
|
props["BuildHash"] = model.BuildHash
|
2016-05-20 10:41:47 -04:00
|
|
|
props["BuildHashEnterprise"] = model.BuildHashEnterprise
|
2015-12-08 13:38:43 -05:00
|
|
|
props["BuildEnterpriseReady"] = model.BuildEnterpriseReady
|
2015-09-16 17:37:11 -07:00
|
|
|
|
2015-09-22 01:15:41 -07:00
|
|
|
props["SiteName"] = c.TeamSettings.SiteName
|
2015-10-06 13:44:52 -07:00
|
|
|
props["EnableTeamCreation"] = strconv.FormatBool(c.TeamSettings.EnableTeamCreation)
|
2015-12-10 16:47:09 -08:00
|
|
|
props["EnableUserCreation"] = strconv.FormatBool(c.TeamSettings.EnableUserCreation)
|
2016-04-21 22:37:01 -07:00
|
|
|
props["EnableOpenServer"] = strconv.FormatBool(*c.TeamSettings.EnableOpenServer)
|
2015-10-20 17:30:24 -07:00
|
|
|
props["RestrictTeamNames"] = strconv.FormatBool(*c.TeamSettings.RestrictTeamNames)
|
2016-05-04 06:31:42 -07:00
|
|
|
props["RestrictDirectMessage"] = *c.TeamSettings.RestrictDirectMessage
|
2015-10-06 13:44:52 -07:00
|
|
|
|
2015-09-21 15:11:56 -07:00
|
|
|
props["EnableOAuthServiceProvider"] = strconv.FormatBool(c.ServiceSettings.EnableOAuthServiceProvider)
|
2015-09-21 19:01:52 -07:00
|
|
|
props["SegmentDeveloperKey"] = c.ServiceSettings.SegmentDeveloperKey
|
|
|
|
|
props["GoogleDeveloperKey"] = c.ServiceSettings.GoogleDeveloperKey
|
2015-09-22 13:18:42 -07:00
|
|
|
props["EnableIncomingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableIncomingWebhooks)
|
2015-10-01 14:07:20 -04:00
|
|
|
props["EnableOutgoingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableOutgoingWebhooks)
|
2016-01-08 12:41:26 -06:00
|
|
|
props["EnableCommands"] = strconv.FormatBool(*c.ServiceSettings.EnableCommands)
|
|
|
|
|
props["EnableOnlyAdminIntegrations"] = strconv.FormatBool(*c.ServiceSettings.EnableOnlyAdminIntegrations)
|
2015-10-05 08:46:23 -04:00
|
|
|
props["EnablePostUsernameOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostUsernameOverride)
|
|
|
|
|
props["EnablePostIconOverride"] = strconv.FormatBool(c.ServiceSettings.EnablePostIconOverride)
|
2016-06-05 02:35:39 -04:00
|
|
|
props["EnableTesting"] = strconv.FormatBool(c.ServiceSettings.EnableTesting)
|
2015-12-14 11:34:16 -08:00
|
|
|
props["EnableDeveloper"] = strconv.FormatBool(*c.ServiceSettings.EnableDeveloper)
|
2015-09-21 15:11:56 -07:00
|
|
|
|
|
|
|
|
props["SendEmailNotifications"] = strconv.FormatBool(c.EmailSettings.SendEmailNotifications)
|
2016-05-19 14:33:04 -04:00
|
|
|
props["SendPushNotifications"] = strconv.FormatBool(*c.EmailSettings.SendPushNotifications)
|
2015-09-22 12:12:50 -07:00
|
|
|
props["EnableSignUpWithEmail"] = strconv.FormatBool(c.EmailSettings.EnableSignUpWithEmail)
|
2016-01-13 14:58:49 -08:00
|
|
|
props["EnableSignInWithEmail"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithEmail)
|
|
|
|
|
props["EnableSignInWithUsername"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithUsername)
|
2015-10-02 16:30:21 -07:00
|
|
|
props["RequireEmailVerification"] = strconv.FormatBool(c.EmailSettings.RequireEmailVerification)
|
2015-09-16 12:36:35 -07:00
|
|
|
props["FeedbackEmail"] = c.EmailSettings.FeedbackEmail
|
2015-09-21 15:11:56 -07:00
|
|
|
|
2015-09-22 12:12:50 -07:00
|
|
|
props["EnableSignUpWithGitLab"] = strconv.FormatBool(c.GitLabSettings.Enable)
|
2015-12-08 13:38:43 -05:00
|
|
|
props["EnableSignUpWithGoogle"] = strconv.FormatBool(c.GoogleSettings.Enable)
|
2015-09-21 15:11:56 -07:00
|
|
|
|
2015-09-15 18:59:14 -07:00
|
|
|
props["ShowEmailAddress"] = strconv.FormatBool(c.PrivacySettings.ShowEmailAddress)
|
2015-09-21 15:11:56 -07:00
|
|
|
|
2015-12-01 11:04:24 -08:00
|
|
|
props["TermsOfServiceLink"] = *c.SupportSettings.TermsOfServiceLink
|
|
|
|
|
props["PrivacyPolicyLink"] = *c.SupportSettings.PrivacyPolicyLink
|
|
|
|
|
props["AboutLink"] = *c.SupportSettings.AboutLink
|
|
|
|
|
props["HelpLink"] = *c.SupportSettings.HelpLink
|
|
|
|
|
props["ReportAProblemLink"] = *c.SupportSettings.ReportAProblemLink
|
|
|
|
|
props["SupportEmail"] = *c.SupportSettings.SupportEmail
|
|
|
|
|
|
2015-09-23 13:47:10 -07:00
|
|
|
props["EnablePublicLink"] = strconv.FormatBool(c.FileSettings.EnablePublicLink)
|
|
|
|
|
props["ProfileHeight"] = fmt.Sprintf("%v", c.FileSettings.ProfileHeight)
|
|
|
|
|
props["ProfileWidth"] = fmt.Sprintf("%v", c.FileSettings.ProfileWidth)
|
2015-09-15 18:59:14 -07:00
|
|
|
|
2016-01-19 19:41:39 +01:00
|
|
|
props["WebsocketPort"] = fmt.Sprintf("%v", *c.ServiceSettings.WebsocketPort)
|
|
|
|
|
props["WebsocketSecurePort"] = fmt.Sprintf("%v", *c.ServiceSettings.WebsocketSecurePort)
|
|
|
|
|
|
2016-06-02 16:47:26 -03:00
|
|
|
props["DefaultClientLocale"] = *c.LocalizationSettings.DefaultClientLocale
|
|
|
|
|
props["AvailableLocales"] = *c.LocalizationSettings.AvailableLocales
|
2016-06-07 14:21:09 +02:00
|
|
|
props["SQLDriverName"] = c.SqlSettings.DriverName
|
2016-03-01 13:00:54 -03:00
|
|
|
|
2016-06-14 09:38:19 -04:00
|
|
|
props["EnableCustomEmoji"] = strconv.FormatBool(*c.ServiceSettings.EnableCustomEmoji)
|
|
|
|
|
props["RestrictCustomEmojiCreation"] = *c.ServiceSettings.RestrictCustomEmojiCreation
|
|
|
|
|
|
2016-04-21 22:37:01 -07:00
|
|
|
if IsLicensed {
|
2016-04-21 10:38:14 -04:00
|
|
|
if *License.Features.CustomBrand {
|
|
|
|
|
props["EnableCustomBrand"] = strconv.FormatBool(*c.TeamSettings.EnableCustomBrand)
|
|
|
|
|
props["CustomBrandText"] = *c.TeamSettings.CustomBrandText
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if *License.Features.LDAP {
|
|
|
|
|
props["EnableLdap"] = strconv.FormatBool(*c.LdapSettings.Enable)
|
|
|
|
|
props["LdapLoginFieldName"] = *c.LdapSettings.LoginFieldName
|
2016-05-02 08:07:58 -04:00
|
|
|
props["NicknameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.NicknameAttribute != "")
|
2016-04-21 10:38:14 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if *License.Features.MFA {
|
|
|
|
|
props["EnableMultifactorAuthentication"] = strconv.FormatBool(*c.ServiceSettings.EnableMultifactorAuthentication)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if *License.Features.Compliance {
|
|
|
|
|
props["EnableCompliance"] = strconv.FormatBool(*c.ComplianceSettings.Enable)
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-14 16:07:58 -07:00
|
|
|
|
2015-09-15 18:59:14 -07:00
|
|
|
return props
|
|
|
|
|
}
|
2016-04-06 08:19:56 -04:00
|
|
|
|
|
|
|
|
func ValidateLdapFilter(cfg *model.Config) *model.AppError {
|
|
|
|
|
ldapInterface := einterfaces.GetLdapInterface()
|
|
|
|
|
if *cfg.LdapSettings.Enable && ldapInterface != nil && *cfg.LdapSettings.UserFilter != "" {
|
|
|
|
|
if err := ldapInterface.ValidateFilter(*cfg.LdapSettings.UserFilter); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
2016-05-03 14:45:36 -04:00
|
|
|
|
|
|
|
|
func Desanitize(cfg *model.Config) {
|
2016-05-17 11:52:49 -03:00
|
|
|
if cfg.LdapSettings.BindPassword != nil && *cfg.LdapSettings.BindPassword == model.FAKE_SETTING {
|
2016-05-03 14:45:36 -04:00
|
|
|
*cfg.LdapSettings.BindPassword = *Cfg.LdapSettings.BindPassword
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if cfg.FileSettings.PublicLinkSalt == model.FAKE_SETTING {
|
|
|
|
|
cfg.FileSettings.PublicLinkSalt = Cfg.FileSettings.PublicLinkSalt
|
|
|
|
|
}
|
|
|
|
|
if cfg.FileSettings.AmazonS3SecretAccessKey == model.FAKE_SETTING {
|
|
|
|
|
cfg.FileSettings.AmazonS3SecretAccessKey = Cfg.FileSettings.AmazonS3SecretAccessKey
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if cfg.EmailSettings.InviteSalt == model.FAKE_SETTING {
|
|
|
|
|
cfg.EmailSettings.InviteSalt = Cfg.EmailSettings.InviteSalt
|
|
|
|
|
}
|
|
|
|
|
if cfg.EmailSettings.PasswordResetSalt == model.FAKE_SETTING {
|
|
|
|
|
cfg.EmailSettings.PasswordResetSalt = Cfg.EmailSettings.PasswordResetSalt
|
|
|
|
|
}
|
|
|
|
|
if cfg.EmailSettings.SMTPPassword == model.FAKE_SETTING {
|
|
|
|
|
cfg.EmailSettings.SMTPPassword = Cfg.EmailSettings.SMTPPassword
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if cfg.GitLabSettings.Secret == model.FAKE_SETTING {
|
|
|
|
|
cfg.GitLabSettings.Secret = Cfg.GitLabSettings.Secret
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if cfg.SqlSettings.DataSource == model.FAKE_SETTING {
|
|
|
|
|
cfg.SqlSettings.DataSource = Cfg.SqlSettings.DataSource
|
|
|
|
|
}
|
|
|
|
|
if cfg.SqlSettings.AtRestEncryptKey == model.FAKE_SETTING {
|
|
|
|
|
cfg.SqlSettings.AtRestEncryptKey = Cfg.SqlSettings.AtRestEncryptKey
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for i := range cfg.SqlSettings.DataSourceReplicas {
|
|
|
|
|
cfg.SqlSettings.DataSourceReplicas[i] = Cfg.SqlSettings.DataSourceReplicas[i]
|
|
|
|
|
}
|
|
|
|
|
}
|