# Copyright (c) 2016 Cyso < development [at] cyso . com >
#
# This file is part of omniconf, a.k.a. python-omniconf .
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from typing import List, Optional, Sequence
from omniconf.backends import autodetection_backends, available_backends
from omniconf.backends.generic import ConfigBackend
from omniconf.config import DEFAULT_REGISTRY as CONFIG_REGISTRY
from omniconf.config import ConfigRegistry
from omniconf.keys import join_key
from omniconf.setting import Setting, SettingRegistry
[docs]
def omniconf_load(
config_registry: Optional[ConfigRegistry] = None,
backends: Optional[Sequence[ConfigBackend]] = None,
autoconfigure_prefix: Optional[str] = None,
) -> None:
"""
Fill the provided :class:`.ConfigRegistry`, by default using all available
backends (as determined by :func:`autoconfigure_backends`. If no
:class:`ConfigRegistry` is provided, the default :class:`.ConfigRegistry`
is used. If unset, autoconfigure_prefix will default to "omniconf".
"""
if not config_registry:
config_registry = CONFIG_REGISTRY
if not backends:
backends = autoconfigure_backends(autoconfigure_prefix)
config_registry.load(backends)