4 ms·
Unless the end user is not technical, use a .py file and force them to subclass your Configuration class which has an __init_subclass__ method so you can enforc
by thomk 6y ago
Unless the end user is not technical, use a .py file and force them to subclass your Configuration class which has an __init_subclass__ method so you can enforce rules.
When you are ready to move to a more generic solution, your .config or .yml file can generate these.
The advantage here is both flexibility (it's Python) and control (allow/disallow whatever you want).
If you need nested items, use nested classes.
- ralston3 6y agoThis. Until you the app reaches the level of advanced yaml config files for cloud deployments, it’s really hard to beat a “config.py” that does a single read of all your ENV_VARS at startup