Add global GetEnv function

This commit is contained in:
akp 2024-10-04 17:14:12 +01:00
parent ce406c7efb
commit 81fb83ed6a
No known key found for this signature in database
GPG key ID: CF8D58F3DEB20755
2 changed files with 7 additions and 0 deletions

View file

@ -1,3 +1,5 @@
* Add global `GetEnv` function
v0.2.0 - 2024-06-18
* Add support for environment variables
* Include string parsing functions

View file

@ -87,6 +87,11 @@ func (cl *ConfigLoader) Get(key string) OptionalItem {
// GetEnv gets a given key from the environment variables.
func (cl *ConfigLoader) GetEnv(envKey string) OptionalItem {
return GetEnv(envKey)
}
// GetEnv gets a given key from the environment variables.
func GetEnv(envKey string) OptionalItem {
ev := os.Getenv(envKey)
if ev == "" {