refactor: add default env variable value

This commit is contained in:
Jonas Kaninda
2024-10-15 15:58:32 +02:00
parent 35bfefafad
commit 6031d2e991
3 changed files with 11 additions and 3 deletions

View File

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