oslo.config

oslo.config

一个用于从命令行和配置文件中解析配置选项的OpenStack库。

cfg模块

可以在命令行或配置文件中设置配置选项。
每个选项的模式使用Opt类或其子类来定义,例如:

from oslo_config import cfg
from oslo_config import types

PortType = types.Integer(1, 65535)

common_opts = [
    cfg.StrOpt('bind_host',
               default='0.0.0.0',
               help='IP address to listen on.'),
    cfg.Opt('bind_port',
            type=PortType,
            default=9292,
            help='Port number to listen on.')
]

你可能感兴趣的:(oslo.config)