infoniqa/pkg/utils/utils.go

16 lines
367 B
Go
Raw Normal View History

2023-10-04 12:48:58 +00:00
package utils
import "os"
// GetEnvString tries to get an environment variable from the system
// as a string value. If the env was not found the given default value
// will be returned
func GetEnvString(name string, defaultValue string) string {
val := defaultValue
if strVal, isSet := os.LookupEnv(name); isSet {
val = strVal
}
return val
}