Helper Functions

oslo_config.cfg.find_config_files(project=None, prog=None, extension='.conf')

Return a list of default configuration files.

Parameters:
  • project – an optional project name
  • prog – the program name, defaulting to the basename of sys.argv[0], without extension .py
  • extension – the type of the config file

We default to two config files: [${project}.conf, ${prog}.conf]

And we look for those config files in the following directories:

~/.${project}/
~/
/etc/${project}/
/etc/

We return an absolute path for (at most) one of each the default config files, for the topmost directory it exists in.

For example, if project=foo, prog=bar and /etc/foo/foo.conf, /etc/bar.conf and ~/.foo/bar.conf all exist, then we return [‘/etc/foo/foo.conf’, ‘~/.foo/bar.conf’]

If no project name is supplied, we only look for ${prog.conf}.

oslo_config.cfg.set_defaults(opts, **kwargs)

Previous topic

The cfgfilter Module

Next topic

Test Fixture

Project Source

This Page