fedmsg
fedmsg copied to clipboard
Simplify the fedmsg configuration
This is up for discussion, but I'd like to propose that we start migrating to a simpler configuration format. I think we can do this in a backwards-compatible way (where we support both the new and old method and eventually remove the old method).
What I'd like is:
-
Use the TOML format loaded with pytoml
-
Load from ~/.config/fedmsg/config.toml. If it's not present, load from /etc/fedmsg/config.toml. Don't do any fancy merging. Allow for configuration to be specified via the CLI as well, which takes precedence over both those locations.
-
Configuration is lazy-loaded and not actually read until the configuration dictionary is actually accessed.
-
Ensure all the defaults are user-friendly and not Fedora-specific.
To use the configuration you just do
>>> from fedmsg import configuration
>>> configuration['zmq_enabled']
True
We can support the old configuration loading (with deprecation warnings) for a while yet and then drop it when the world is ready for the future.
Do note that this is going to impact quite some apps, in our control and out of it
It'll be backwards compatible and people will have plenty of time to migrate
i like the fact that configuration is in separate files. that allows distribution (rpm) package provide default config. and less pain for sysadmins to merge huge config when some new component is added (distro package with it's own config).
That's a good point.
Perhaps a better scheme would be:
If a file is specified on the CLI, use that (and only that) configuration. Otherwise, load all configuration from /etc/fedmsg/conf.d/. If there are duplicate keys in any of the files, report it as an error to the user.