pypuppetdb
pypuppetdb copied to clipboard
Add support for a config file
It would be cool if this library could read the PuppetDB URL, certificate and key paths and all other connect parameters from a config file.
This would allow easier writing of cli tools using this library as they could all share a common configuration, out of the box.
I propose to use the same path and config syntax as Puppet's own PuppetDB cli as this will provide a single configuration place for users of both the Puppet Enterprise and this library or its derivatives.
If this is something that would get merged then I can provide a PR. :)
I would extend the pattern of the PuppetDB cli's configuration file order with reading also ./puppetdb.conf
, if it is present.
This would allow the users of multiple PuppetDBs (like testing and production instances) to easily switch between them by cd
-ing to the appropriate directory with the right config.
(This is a method that we are already successfully using for the multiple sets of keys for hiera-eyaml
.)
We could also consider adding support for providing a configuration file path with an env variable - this is probably another popular pattern for this problem.