refactor: add default env variable value

This commit is contained in:
Jonas Kaninda
2024-10-15 16:43:02 +02:00
parent 3527b4cdcd
commit 24ccdaa671
2 changed files with 10 additions and 3 deletions

View File

@@ -180,3 +180,10 @@ func GetIntEnv(envName string) int {
}
return ret
}
func EnvWithDefault(envName string, defaultValue string) string {
value := os.Getenv(envName)
if value == "" {
return defaultValue
}
return value
}