def get(entity, param):
"""
Returns the configuration value belonging to a specified entity
(e.g. neo4j) and parameter (e.g. host).
:param entity: The configuration entity
:param param: The configuration parameter
:return: The configuration value
:raises ValueError if a requested parameter is not configured
"""
try:
value = _get_config()[entity][param]
LOGGER.debug('Found config: {}:{} => {}'.format(entity, param, value))
return _get_config()[entity][param]
except KeyError:
# Should _never_ happen in production!
msg = 'Parameter {} is not present for entity {}!'.format(param,
entity)
LOGGER.critical(msg)
raise ValueError(msg)
评论列表
文章目录