Loading Configuration Files

Loading Configuration Files

The config manager has two CLI options defined by default, --config-file and --config-dir:

class ConfigOpts(object):

    def __call__(self, ...):

        opts = [


Option values are parsed from any supplied config files using oslo_config.iniparser. If none are specified, a default set is used for example glance-api.conf and glance-common.conf:

  bind_port = 9292

  bind_host =

Lines in a configuration file should not start with whitespace. A configuration file also supports comments, which must start with ‘#’ or ‘;’. Option values in config files and those on the command line are parsed in order. The same option (includes deprecated option name and current option name) can appear many times, in config files or on the command line. Later values always override earlier ones.

The order of configuration files inside the same configuration directory is defined by the alphabetic sorting order of their file names. Files in a configuration directory are parsed after any individual configuration files, so values that appear in both a configuration file and configuration directory will use the value from the directory.

The parsing of CLI args and config files is initiated by invoking the config manager for example:

conf = cfg.ConfigOpts()
conf.register_opt(cfg.BoolOpt('verbose', ...))
if conf.verbose:

Option Value Interpolation

Option values may reference other values using PEP 292 string substitution:

opts = [
               default=os.path.join(os.path.dirname(__file__), '../'),
               help='Top-level directory for maintaining nova state.'),
               help='File name for SQLite.'),
               help='Connection string for SQL database.'),


Interpolation can be avoided by using $$.


You can use . to delimit option from other groups, e.g. ${mygroup.myoption}.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.