def smush_config(sources, initial=None): """Merge the configuration sources and return the resulting DotDict.""" if initial is None: initial = {} config = DotDict(initial) for fn in sources: log.debug('Merging %s', fn) mod = get_config_module(fn) config = mod.update(config) log.debug('Current config:\n%s', json.dumps(config, indent=4, cls=LenientJSONEncoder)) return config
def filter_config(config, deploy_config): """Return a config subset using the filter defined in the deploy config.""" if not os.path.isfile(deploy_config): return DotDict() config_module = get_config_module(deploy_config) return config_module.filter(config)