From 81fb83ed6aeb816ed3f6658a3f6d4734500b1b95 Mon Sep 17 00:00:00 2001 From: AKP Date: Fri, 4 Oct 2024 17:14:12 +0100 Subject: [PATCH] Add global GetEnv function --- CHANGELOG | 2 ++ cfger.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 22f7a08..96a1a04 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ + * Add global `GetEnv` function + v0.2.0 - 2024-06-18 * Add support for environment variables * Include string parsing functions diff --git a/cfger.go b/cfger.go index 28d7617..3407005 100644 --- a/cfger.go +++ b/cfger.go @@ -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 == "" {