MCPcopy Create free account
hub / github.com/caarlos0/env / config

Struct config

example_test.go:180–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178// some other kind of logic.
179func ExampleParseWithOptions_onSet() {
180 type config struct {
181 Home string `env:"HOME,required"`
182 Port int `env:"PORT" envDefault:"3000"`
183 IsProduction bool `env:"PRODUCTION"`
184 NoEnvTag bool
185 Inner struct{} `envPrefix:"INNER_"`
186 }
187 os.Setenv("HOME", "/tmp/fakehome")
188 var cfg config
189 if err := ParseWithOptions(&cfg, Options{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected