-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
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
Support recursive required
and friends for nested structs
#55
Comments
I understood that embedding struct with env tag should prefix everything in embedded struct with that tag. So But I do not completely understand intention and semantics of type Config struct {
Foo string `env:"FOO,required"`
Bar string `env:"BAR"`
Baz string `env:"BAZ" default:"some value"`
}
var cfg struct {
Config `env:"APP_,required"`
} required on the root will make all the fields required and discard default? Or will just make Bar required, and Baz will keep it's default? Or in general, having a path of nested fields like A_B_C_D, if any of the fields has |
Yes. Or just a group of variables: type Config struct {
// all DB_* variables are required:
DB struct {
Host string `env:"DB_HOST"`
Port string `env:"DB_PORT"`
} `env:",required"`
// the rest of the fields...
}
Currently, marking a variable as both
Yes. In general, I'd like it to be a convenience option, so users could specify a modifier just once. Just like prefixing nested structs that you implemented recently. |
Something like:
See the conversation from #52 for details.
The text was updated successfully, but these errors were encountered: