__init__.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:aetros-cli 作者: aetros 项目源码 文件源码
def read_config(path = 'aetros.yml', logger=None):
    path = os.path.normpath(os.path.expanduser(path))

    config = {
        'dockerfile': None,
        'command': None,
        'install': None,
        'ignore': None,
        'image': None,
        'server': None,
        'parameters': {},
        'servers': None,
        'before_command': [],
    }

    if os.path.exists(path):
        f = open(path, 'r')

        custom_config = yaml.safe_load(f)
        if custom_config is None:
            custom_config = {}

        if 'storage_dir' in custom_config:
            del custom_config['storage_dir']

        config.update(custom_config)

        logger and logger.debug('Config loaded from ' + os.path.realpath(path))

    if 'parameters' not in config:
        config['parameters'] = {}

    return config
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号