def parse_config(cfg, ext_config={}):
config = {}
try:
options = cfg.options('pypdns')
except ConfigParser.NoSectionError:
log.debug('No config files provided and default not present')
options = []
for option in options:
config[option] = cfg.get('pypdns', option)
for ckey, cvalue in iteritems(DEFAULT_CONFIG):
if ckey not in config:
config[ckey] = cvalue
for k in ('endpoint', 'apikey'):
if ext_config.get(k) is not None:
config[k] = ext_config[k]
assert (config.get('endpoint') is not None and
config.get('apikey') is not None), 'Configuration not found'
return config
评论列表
文章目录