def load_dynamic_config(configurations, config_dir=getcwd()):
"""Load and parse dynamic config"""
# Create full path of config
config_file = '{path}/config.py'.format(path=config_dir)
# Insert config path so we can import it
sys.path.insert(0, path.dirname(path.abspath(config_file)))
try:
config_module = __import__('config')
for key, value in config_module.CONFIG.items():
LOG.debug('Importing %s with key %s', key, value)
# Update configparser object
configurations.update({key: value})
except ImportError:
# Provide a default if config not found
configurations = {}
评论列表
文章目录