permit setting of verbosity from config

Signed-off-by: Matthew R. Kasun <mkasun@nusak.ca>
This commit is contained in:
Matthew R. Kasun 2022-04-21 16:18:27 -04:00
parent 7152f6ccd4
commit fa29b09aab
2 changed files with 17 additions and 1 deletions

View file

@ -52,7 +52,7 @@ type ServerConfig struct {
Platform string `yaml:"platform"`
Database string `yaml:"database"`
DefaultNodeLimit int32 `yaml:"defaultnodelimit"`
Verbosity int32 `yaml:"verbosity"`
Verbosity int `yaml:"verbosity"`
ServerCheckinInterval int64 `yaml:"servercheckininterval"`
AuthProvider string `yaml:"authprovider"`
ClientID string `yaml:"clientid"`

View file

@ -90,6 +90,7 @@ func GetServerConfig() config.ServerConfig {
services := strings.Join(GetPortForwardServiceList(), ",")
cfg.PortForwardServices = services
cfg.Server = GetServer()
cfg.Verbosity = GetVerbosity()
return cfg
}
@ -352,6 +353,21 @@ func GetServer() string {
return server
}
func GetVerbosity() int {
var verbosity = 0
var err error
if os.Getenv("VERBOSITY") != "" {
verbosity, err = strconv.Atoi(os.Getenv("VERBOSITY"))
if err != nil {
verbosity = 0
}
} else if config.Config.Server.Verbosity != 0 {
verbosity = config.Config.Server.Verbosity
}
logger.Verbosity = int(verbosity)
return verbosity
}
// IsDNSMode - should it run with DNS
func IsDNSMode() bool {
isdns := true