Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jackc/envconf
Envconf is a simple, zero dependency library for managing configuration from the environment.
https://github.com/jackc/envconf
Last synced: 24 days ago
JSON representation
Envconf is a simple, zero dependency library for managing configuration from the environment.
- Host: GitHub
- URL: https://github.com/jackc/envconf
- Owner: jackc
- License: mit
- Created: 2024-06-02T02:59:28.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-06-02T12:49:11.000Z (5 months ago)
- Last Synced: 2024-06-19T03:13:39.459Z (5 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Reference](https://pkg.go.dev/badge/github.com/jackc/envconf.svg)](https://pkg.go.dev/github.com/jackc/envconf)
[![Build Status](https://github.com/jackc/envconf/actions/workflows/ci.yml/badge.svg)](https://github.com/jackc/envconf/actions/workflows/ci.yml)# Envconf
Envconf is a simple, zero dependency library for managing configuration from the environment. It adds default values,
variable descriptions, and the ability to inject a environment fetching function.Example usage:
```go
config := envconf.New()// Register configuration items.
config.Register(envconf.Item{
Name: "FOO",
Default: "default-foo",
Description: "the foo",
})config.Register(envconf.Item{
Name: "BAR",
Default: "default-bar",
Description: "the bar",
})foo := config.Value("FOO") // returns ENV["FOO"] or "default-foo"
bar = config.Value("BAR") // returns ENV["BAR"] or "default-bar"
```