oslo.config
一個用于從命令行和配置文件中解析配置選項的OpenStack庫。
cfg模塊
可以在命令行或配置文件中設(shè)置配置選項溉躲。
每個選項的模式使用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.')
]