Registry / config / nicholasjackson-env

nicholasjackson-env

JSON →
library0.6.1gogounverified

Package env provides a simple way to parse environment variables into Go structs.

go get github.com/nicholasjackson/env
INSTALL
IMPORT
SIG · NICHOLASJACKSON-EN
N
nicholasjackson-env
configgov0.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

env
github.com/nicholasjackson/env

Parse environment variables into a struct

package main import ( "fmt" "github.com/nicholasjackson/env" ) type Config struct { Port int `env:"PORT" default:"8080"` Host string `env:"HOST" default:"localhost"` } func main() { var cfg Config env.Parse(&cfg) fmt.Printf("Listening on %s:%d\n", cfg.Host, cfg.Port) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.6.1latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
Resources
nicholasjackson-env — go get nicholasjackson-env · libregistry