Added some tests for sharedlibrary

This commit is contained in:
Pijus Kamandulis
2024-12-19 23:21:45 +02:00
parent be7a615931
commit 363f822e5a
11 changed files with 276 additions and 24 deletions

View File

@@ -57,6 +57,18 @@ func (c *ServerConfig) PopulateCalculatedFields() {
logger.EnableDebugOutput = c.Debug
}
func (c *ServerConfig) ApplyDefaultsToEmptyFields() {
if c.Host == "" {
c.Host = "localhost"
}
if c.Port == 0 {
c.Port = 8081
}
if c.AccountKey == "" {
c.AccountKey = DefaultAccountKey
}
}
func setFlagsFromEnvironment() (err error) {
flag.VisitAll(func(f *flag.Flag) {
name := EnvPrefix + strings.ToUpper(strings.Replace(f.Name, "-", "_", -1))