Ecosyste.ms: Packages

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

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/tike/envcnf/v2

Package envcnf parses envvars into composite types, e.g. for configuration. The problem: Passing configuration values to a daemon, e.g. a webserver, via environement variables can be tedious with go's onboard means and available libraries are limited in the types they support and in their handling of composite types, like structs, map and/or slices and especially arbitrarily nested combinations of these. The solution: Package envcnf allows you to pass your configuration to your application via environment variables comfortably, reliably and without (practical) limitations. How: 1. Name your env vars to match your config type's field names, case conversion to match all lower or all upper case is supported. You can of course use a common prefix to set them apart from "regular" env vars and thous even have different configuration sets loaded at the same time, designating each set by a different prefix. 2. Use direnv (https://github.com/direnv/direnv) to maintain and organise your configuration in shell script like files or just source them by hand. 3. Parse the configuration from the environment variables into your config struct, map, slice or any (however deeply nested and complex) combination thereof with __1 line of code__. Take a look at the examples ;-) 4. That's it! Spend your time on writing code that matters :-)

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/tike/envcnf/v2
Keywords: configuration, configuration-by-environment, configuration-management, direnv, environment-variables, environment-vars, golang, golang-lib, golang-library
License: MIT
Latest release: almost 2 years ago
First release: almost 2 years ago
Namespace: github.com/tike/envcnf
Stars: 1 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 25 days ago

    Loading...
    Readme
    Loading...