美文网首页
oslo.config

oslo.config

作者: PPMac | 来源:发表于2017-08-30 14:23 被阅读29次

    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

          本文链接:https://www.haomeiwen.com/subject/qrnzdxtx.html