PLT-6317 disable file watcher while running from makefile (#6103)
* PLT-6317 disable file watcher while running from make file * Removing debug stmt
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
3207886514
Коммит
acc991dea1
2
Makefile
2
Makefile
@@ -417,7 +417,7 @@ run-server: prepare-enterprise start-docker
|
||||
@echo Running mattermost for development
|
||||
|
||||
mkdir -p $(BUILD_WEBAPP_DIR)/dist/files
|
||||
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) ./cmd/platform/*.go &
|
||||
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) ./cmd/platform/*.go --disableconfigwatch &
|
||||
|
||||
run-cli: prepare-enterprise start-docker
|
||||
@echo Running mattermost for development
|
||||
|
||||
@@ -136,7 +136,6 @@ func SaveConfig(cfg *model.Config) *model.AppError {
|
||||
return model.NewLocAppError("saveConfig", "ent.cluster.save_config.error", nil, "")
|
||||
}
|
||||
|
||||
//oldCfg := utils.Cfg
|
||||
utils.DisableConfigWatch()
|
||||
utils.SaveConfig(utils.CfgFileName, cfg)
|
||||
utils.LoadConfig(utils.CfgFileName)
|
||||
@@ -150,6 +149,7 @@ func SaveConfig(cfg *model.Config) *model.AppError {
|
||||
}
|
||||
}
|
||||
|
||||
// oldCfg := utils.Cfg
|
||||
// Future feature is to sync the configuration files
|
||||
// if einterfaces.GetClusterInterface() != nil {
|
||||
// err := einterfaces.GetClusterInterface().ConfigChanged(cfg, oldCfg, true)
|
||||
|
||||
@@ -20,6 +20,7 @@ func doLoadConfig(filename string) (err string) {
|
||||
utils.LoadConfig(filename)
|
||||
utils.InitializeConfigWatch()
|
||||
utils.EnableConfigWatch()
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ func main() {
|
||||
|
||||
func init() {
|
||||
rootCmd.PersistentFlags().StringP("config", "c", "config.json", "Configuration file to use.")
|
||||
rootCmd.PersistentFlags().Bool("disableconfigwatch", false, "When set config.json will not be loaded from disk when the file is changed.")
|
||||
|
||||
resetCmd.Flags().Bool("confirm", false, "Confirm you really want to delete everything and a DB backup has been performed.")
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ func runServerCmd(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
utils.CfgDisableConfigWatch, _ = cmd.Flags().GetBool("disableconfigwatch")
|
||||
|
||||
runServer(config)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ var Cfg *model.Config = &model.Config{}
|
||||
var CfgDiagnosticId = ""
|
||||
var CfgHash = ""
|
||||
var CfgFileName string = ""
|
||||
var CfgDisableConfigWatch = false
|
||||
var ClientCfg map[string]string = map[string]string{}
|
||||
var originalDisableDebugLvl l4g.Level = l4g.DEBUG
|
||||
var siteURL = ""
|
||||
@@ -178,6 +179,10 @@ func InitializeConfigWatch() {
|
||||
cfgMutex.Lock()
|
||||
defer cfgMutex.Unlock()
|
||||
|
||||
if CfgDisableConfigWatch {
|
||||
return
|
||||
}
|
||||
|
||||
if watcher == nil {
|
||||
var err error
|
||||
watcher, err = fsnotify.NewWatcher()
|
||||
@@ -215,11 +220,13 @@ func EnableConfigWatch() {
|
||||
cfgMutex.Lock()
|
||||
defer cfgMutex.Unlock()
|
||||
|
||||
configFile := filepath.Clean(CfgFileName)
|
||||
configDir, _ := filepath.Split(configFile)
|
||||
|
||||
if watcher != nil {
|
||||
watcher.Add(configDir)
|
||||
configFile := filepath.Clean(CfgFileName)
|
||||
configDir, _ := filepath.Split(configFile)
|
||||
|
||||
if watcher != nil {
|
||||
watcher.Add(configDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user