Ecosyste.ms: Packages

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

Top 6.6% on proxy.golang.org
Top 1.9% dependent packages on proxy.golang.org
Top 1.1% dependent repos on proxy.golang.org

proxy.golang.org : github.com/deanishe/go-env

Package env maps environment variables to struct fields and vice versa. It is heavily based on github.com/caarlos0/env, but has different semantics, and also allows the dumping of a struct to environment variables, not just populating a struct from environment variables. Read environment variables with the Get* functions: Populate a struct from the environment by passing it to Bind(): Use tags to specify a variable name or ignore a field: Dump a struct to a map[string]string by passing it to Dump(): Add `env:"..."` tags to your struct fields to bind them to specific environment variables or ignore them. `env:"-"` tells Bind() to ignore the field: Add `env:"VARNAME"` to bind a field to the variable VARNAME: Variables are retrieved via implementors of the Env interface, which Bind() accepts as a second, optional parameter. So you can pass a custom Env implementation to Bind() to populate structs from a source other than environment variables. See _examples/docopt to see a custom Env implementation used to populate a struct from docopt command-line options. You can also customise the map keys used when dumping a struct by passing VarNameFunc to Dump(). This library is released under the MIT Licence.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/deanishe/go-env
Keywords: configuration, environment-variables, envvars, mapping, settings, struct
License: MIT
Latest release: almost 4 years ago
First release: over 4 years ago
Namespace: github.com/deanishe
Dependent packages: 8
Dependent repositories: 26
Stars: 10 on GitHub
Forks: 1 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 27 days ago

    Loading...
    Readme
    Loading...