Feature idea: Use pydantic for loading configuration
See original GitHub issueToday Slack Machine uses a plain python file for its config, which I find less than ideal.
I would like to put my bot in git, but I don’t want to commit any secrets into git.
To solve this I tried to do a simple import of the yaml
module in local_settings.py
, and load my secrets from there, but this won’t work when using Redis as storage backend.
The reason it won’t work is that the config is pickled and put into the storage, so any object will yield the error message seen in issue #273.
Changing to Dynaconf provides the benefit of letting me store my secrets separately from the main config. It will also provide a lot of other benefits and features that Dynaconf provides, like letting me choose which format I want to store my config in, multiple environments etc.
What do you think?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Might indeed be useful. I dropped you an email to discuss Slack Machine in a more general sense.
Hey @davidolrik, I don’t know if you’re still using Slack Machine, but I’m working on it again. My first order of business is making it use asyncio (and in the process, generally refactoring it).
Configuration is another important topic I’d like to tackle soon. I’ve been reading over this issue again, and I wonder what the best approach is. I think Dynaconf and Pydantic are both valid options. I wonder if we’d use Pydantic, how we would deal with new settings required by plugins. Pydantic models are static, so the only think I can think of is to add a sort of “catch-all” dict setting on the Settings model. Do you have another idea?
If you moved past using Slack Machine, I also totally understand and won’t bother you again!