-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: Add envconfig
annotation for non-nested structs + env_prefix
attribute
#43
base: master
Are you sure you want to change the base?
Conversation
envconfig
annotation for non-nested structs + env_prefix
attribute
Added a commit to upgrade the |
b8da4e5
to
71e80e9
Compare
@Greesb Thanks for your PR. I left some comments. |
Thanks for the review, i'll handle them when i get back home. The use case is that all of our application environment variables have a prefix, so we can avoid env variable "collision", and we want to use, in our application, those environment variables based on their names without the prefix since it's redundant, irrelevant and is way too much verbose. |
This attribute allows to add an annotation like so `#[envconfig(env_prefix = "...")]` on top of a struct. The `env_prefix` will be applied to every config attribute in the struct.
Hello, I am new to Rust and thought of this feature while using it for another training project.
This should allow to parse environment variables that have a common prefix without having to use that prefix in every variables.
I also took the liberty to update the dependencies to their latest version, except for
syn
because it would require more work, because i feel like it's always better to have the latest updates for any dependencies if it might improve performance or patch some security issues.I'll gladly take any input if the code, or even the logic, can be improved in any way.