typesafe env variables
- Go 91%
- Nix 9%
| dotenv | feat: dotenv | |
| examples | feat: custom validations | |
| .env.example | feat: nested structs handling ( #1 ) | |
| .envrc | feat: skeleton | |
| .gitignore | feat: skeleton | |
| env.go | fuck | |
| flake.lock | feat: skeleton | |
| flake.nix | feat: skeleton | |
| go.mod | feat: skeleton | |
| LICENSE | Initial commit | |
| README.md | feat: nested structs handling ( #1 ) | |
| validator.go | feat: custom validations | |
env
typesafe env utilities for go.
why env exists
most go config libraries try to solve everything: files, env, flags, hot reloads, plugins, abstractions on abstractions.
env doesn't.
usage
packagemainimport("fmt""codeberg.org/ungo/env""codeberg.org/ungo/env/dotenv")typeConfigstruct{Ageint`env:"AGE,default=30"`ApiUserstring`env:"API_USER,default=yehorovye"`}varcfgConfigfuncinit(){// load .env.example file manuallydotenv.MustLoad(".env.example")// parse structerr:=env.Load(&cfg)iferr!=nil{panic(err)}}funcmain(){fmt.Println(cfg.ApiUser,"your age is...",cfg.Age)// elisiei your age is 30}
maintainers
license
this software is published under CC0 1.0 Universal (public domain) along with an ip waiver. see license file.
aka: do whatever you want.