config.py: merge default module configs into user config - #218
Conversation
e7f6398 to
14f153f
Compare
|
Seems like a rather good idea to me! I would say that it'd make sense for the module base class to provide |
14f153f to
c6006d2
Compare
Added. If you are generally fine with the idea, anything else to change? I am not sure if I am using "module_name" correctly, there is
|
To be honest I'm not sure I designed that part correctly. I can't even remember how it works now. I'll have to check. EDIT: |
|
I think this is ready for merging after rebase+squash. The idea that the defaults are specified in the module and not in the default configuration is perfect! Thanks 👍 |
c6006d2 to
5209aab
Compare
|
done, rebased and squashed |
|
Great! Thanks :) |
This allows modules which provide a method called get_default_config() to return a dict of own default settings which will then be merged into the global config as config["modules"][$module_name].
This can then be modified by a user config using the same path.
The idea is that modules can provide their own default config without modifying defaults.json and still allow the user to modify that config which can be useful for e.g. out-of-tree modules.
It also prevents clutter of defaults.json with config options for modules which are not actually used by the user.
Another possible use case would be to have every module expose a default boolean config option like "enabled" which can default to false. Then the user can manually enable modules which are more of special case modules and does not have to delete or move the module file itself.
Instead of testing if the module provides a get_default_config() function it could also be implemented in the module base class.Things to do:
add get_default_config() as stub inside module base classrebase on devsquash