refactor: add default env variable value

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

No files matched your search

+8
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
}