-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add "separator" to parse nested structs #55
Comments
I want to mention one alternative using
|
Worth noting that |
I would be really interested in such a feature and have even considered implementing on my own. Slightly more context: Using |
fwiw, I collated a list of similar Rust crates, trying to find ones which do nested structs, at Xuanwo/serde-env#54 |
💡 Feature description
In config-rs, there's an option to define a
separator
which allow users to structure their env vars. I think an example will illustrate better:If we define a separator, let's say "__", we could create this
Config
by settingDATABASE__NAME=foo
.Would it be possible and desirable for
envy
to include it?Alternatives
It is possible to get the same behavior using the
flatten
attribute from serde (as noticed in #15). The drawback is that it demands a good amount of boilerplate because we would have to serde'srename
every field in the nested struct if we wanted to use this separator idea.The text was updated successfully, but these errors were encountered: