We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref:
package main import ( "encoding/json" "fmt" "log" "os" "github.com/caarlos0/env/v10" ) type Test struct { Str string `env:"TEST"` } type ComplexConfig struct { Foos []Test `envPrefix:"FOO_"` Clean Test `envPrefix:"BAR_"` } func main() { os.Setenv("FOO_TEST", "kek") os.Setenv("FOO_0_TEST", "kek0") os.Setenv("FOO_1_TEST", "kek1") os.Setenv("BAR_TEST", "lel") cfg := ComplexConfig{} err := env.Parse(&cfg) if err != nil { log.Fatal(err) } confBytes, _ := json.Marshal(cfg) fmt.Printf("%s", confBytes) }
output:
{"Foos":null,"Clean":{"Str":"lel"}}
The text was updated successfully, but these errors were encountered:
@caarlos0 let me know if you'd like to make this change, happy to help
Sorry, something went wrong.
on the top of my head I can't think of a reason why not... if you wanna try pls go for it 🙏
@akutuev Will you add pr for this feat? I can help
Hi, no worries, I'm planning to take a look very soon, thanks
No branches or pull requests
ref:
output:
The text was updated successfully, but these errors were encountered: