[#3896bk] Configure base support for properties file parsing

This commit is contained in:
Dane Everitt
2019-11-30 18:07:05 -08:00
parent 11c6738264
commit 1003abaa63
6 changed files with 145 additions and 43 deletions

33
server/config_parser.go Normal file
View File

@@ -0,0 +1,33 @@
package server
import (
"go.uber.org/zap"
"sync"
)
// Parent function that will update all of the defined configuration files for a server
// automatically to ensure that they always use the specified values.
func (s *Server) UpdateConfigurationFiles() {
wg := new(sync.WaitGroup)
for _, v := range s.processConfiguration.ConfigurationFiles {
wg.Add(1)
go func(server *Server) {
defer wg.Done()
p, err := s.Filesystem.SafePath(v.FileName)
if err != nil {
zap.S().Errorw("failed to generate safe path for configuration file", zap.String("server", server.Uuid), zap.Error(err))
return
}
if err := v.Parse(p); err != nil {
zap.S().Errorw("failed to parse and update server configuration file", zap.String("server", server.Uuid), zap.Error(err))
}
}(s)
}
wg.Wait()
}