-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Feature Request: Template for dotenv configuration format #20
Comments
The problem is that confique deserialization from environment variables only works for basic types, but not lists or maps (also see #10). So I don't think Note that you as a library user can generate the template for dotenv yourself by inspecting the |
If it is impossible to present some configuration only through dotenv, then it would be good to know about it within the compile time. It seems to me, the template for dotenv simply shouldn't compile in that case (with an understandable and good error). This, among other things, will avoid a potential error when a developer who is not familiar with this framework limitation cannot add such a array\map property. |
The Finally, the derive macro can't know for sure whether a type can or cannot be deserialized well from an env variable. In case you're not familiar with proc macros: the macro only knows that you wrote |
Yes, I forgot about support for any deserializable type for other configuration providers. In this case, since templates are generated at runtime, I think that it is more flexible to write warning in dotenv example. However, this task must wait for #10 to be implemented in the best possible way. |
Now that #10 is closed, progress on this issue is possible In general, the situation has not changed much, except that the However, since support is implemented through a simple function, then annotations with a possible format will have to be added manually (in rustdoc) if some auxiliary function built into the library is not used. If the Summary:
Feel free to correct my judgment @LukasKalbertodt |
We can't know that. Right now,
Similar thing here. First: how to warn? So what I'm basically saying: we can't check in Now. What about default values of type array or map? That's a tricky question. As I said above, we cannot gain any useful information from the So I think I see a number of options:
One other idea is to let people specify I'm not sure about any of this. But having thought it through and written down now, I think I would suggest (a). It's certainly the easiest. Its disadvantage of course is that people have to write the default value twice (in the So yeah: thoughts or opinions on this? Would you agree with my conclusion of going with (a) for now? |
@LukasKalbertodt I agree that one can start with (a). At least there is no problem improve this solution in the future. |
I constantly need to give the .env.example file to the devops team and maintain it consistency with in-code structure by hand is inconvenient.
In the current implementation of Confique, the best solution is to give a template from a different format (like toml), where all the env keys are presented, but this does not look like the best solution. If there are no fundamental objections within the project, I will add a dotenv template by myself.
The text was updated successfully, but these errors were encountered: