Add global GetEnv function
This commit is contained in:
parent
ce406c7efb
commit
81fb83ed6a
2 changed files with 7 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
* Add global `GetEnv` function
|
||||||
|
|
||||||
v0.2.0 - 2024-06-18
|
v0.2.0 - 2024-06-18
|
||||||
* Add support for environment variables
|
* Add support for environment variables
|
||||||
* Include string parsing functions
|
* Include string parsing functions
|
||||||
|
|
5
cfger.go
5
cfger.go
|
@ -87,6 +87,11 @@ func (cl *ConfigLoader) Get(key string) OptionalItem {
|
||||||
|
|
||||||
// GetEnv gets a given key from the environment variables.
|
// GetEnv gets a given key from the environment variables.
|
||||||
func (cl *ConfigLoader) GetEnv(envKey string) OptionalItem {
|
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)
|
ev := os.Getenv(envKey)
|
||||||
|
|
||||||
if ev == "" {
|
if ev == "" {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue