diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2024-09-30 11:16:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-30 11:16:28 -0400 |
| commit | 18791a4e6e08de406e9c1e257cc4be2a85f29eea (patch) | |
| tree | 0a32b7b821a229e0bbdf11775f3e66c2fce24217 /env | |
| parent | 69d3e0c46e34a57e6cfcb58d36b28c6f0beb134e (diff) | |
feat(config): Allow avoiding reading default config file (#2227)
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'env')
| -rw-r--r-- | env/env.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -20,3 +20,13 @@ func ExpandEnv(s string) string { fsys := datafs.WrapWdFS(osfs.NewFS()) return datafs.ExpandEnvFsys(fsys, s) } + +// LookupEnv - retrieves the value of the environment variable named by the key. +// If the variable is unset, but the same variable ending in `_FILE` is set, the +// referenced file will be read into the value. If the key is not set, the +// second return value will be false. +// Otherwise the provided default (or an emptry string) is returned. +func LookupEnv(key string) (string, bool) { + fsys := datafs.WrapWdFS(osfs.NewFS()) + return datafs.LookupEnvFsys(fsys, key) +} |
