File: globals.rst

package info (click to toggle)
python-oslo.config 1%3A8.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,192 kB
  • sloc: python: 10,740; makefile: 30; sh: 10
file content (21 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
===================
 Global ConfigOpts
===================

This module also contains a global instance of the ConfigOpts class
in order to support a common usage pattern in OpenStack:

.. code-block:: python

    from oslo_config import cfg

    opts = [
        cfg.StrOpt('bind_host', default='0.0.0.0'),
        cfg.PortOpt('bind_port', default=9292),
    ]

    CONF = cfg.CONF
    CONF.register_opts(opts)

    def start(server, app):
        server.start(app, CONF.bind_port, CONF.bind_host)