An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/oxplot/starenv

Package starenv implements populating environmental variables from variety of sources. Simplest way to use starenv is to import the autoload package: The above will iterate through all environmental variables looking for specially formatted values which tell it where to load the final values from. After the above is imported, you can use the usual os.Getenv() to get the value of environmental variables. The source of a value is defined as a pipeline of "derefer" tags followed by the reference for the last derefer. Here is an example of a environmental variable specifying to load its value from a base64 encoded file and decrypt it using GPG: Each derefer is applied in reverse, starting with "file" which loads the content of "~/.github_token". "b64" then decodes it and finally "gpg" decrypts it. If the value of an environmental variable starts with Loader.Star (which defaults to "*"), it is treated as a pipeline. Otherwise, it's treated as a literal value and left unchagned. In the unlikely case where a literal value starting with Loader.Star is needed, the following can be used: Here the blank derefer treats everything after "*:" as literal and returns it, thus leading to GLOB_PAT being set to "*.terraform". Package autoload registers a set of derefers that are included in derefer package with appropriate tags. To have more control over tags and the timing of when the loading happens, you can register each derefer manually and call Load() to populate the env vars. When using the autoload package, .env file is also read and loaded. To disable this, set DOTENV_ENABLED=0. Any type that implements Derefer methods can be registered and used in the pipeline.

Ecosystem
proxy.golang.org
Latest Release
v0.14.0
about 3 years ago
Versions
14
Dependent Repos
1
Past Dependents
Include Past Dependents

Check this option to include packages that no longer depend on this package in their latest version but previously did.

Filter
Filter by Kind
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/oxplot/starenv
spec
License BSD-3-Clause
Namespace github.com/oxplot
First Release over 4 years ago
Last Synced 22 days ago
Repository
Stars 6 on GitHub
Forks 0 on GitHub
Rankings on proxy.golang.org
Dependent repos Top 4.8%