def read_configuration(key, path=None, default=None, single_config=False, fallback_to_env=True):
if path and os.path.exists(path):<EOL><INDENT>with open(path, '<STR_LIT:r>') as config_file:<EOL><INDENT>if single_config:<EOL><INDENT>return config_file.read()<EOL><DEDENT>for line in config_file:<EOL><INDENT>if line.startswith('<STR_LIT>' % key):<EOL><INDENT>return line.split('<STR_LIT:=>', <NUM_LIT:1>)[<NUM_LIT:1>].strip()<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if fallback_to_env and key in os.environ:<EOL><INDENT>return os.environ[key]<EOL><DEDENT>return default<EOL>
Read configuration from a file, Docker config or secret or from the environment variables.

:param key: the configuration key
:param path: the path of the configuration file (regular file or Docker config or secret)
:param default: the default value when not found elsewhere (default: `None`)
:param single_config: treat the configuration file as containing the full configuration,
    otherwise the file is expected to be a '=' separated key-value list line by line
    (default: `False`)
:param fallback_to_env: look for the configuration key in the environment variables
    if not found elsewhere (default: `True`)