detect active default config

This commit is contained in:
Peter Bieringer 2024-06-07 08:35:26 +02:00
parent 28fa28aaff
commit c7c3119267
2 changed files with 13 additions and 2 deletions

View file

@ -53,9 +53,14 @@ def _get_application_instance(config_path: str, wsgi_errors: types.ErrorStream
config_path))
log.set_level(cast(str, configuration.get("logging", "level")))
# Log configuration after logger is configured
default_config_active = True
for source, miss in configuration.sources():
logger.info("%s %s", "Skipped missing" if miss
logger.info("%s %s", "Skipped missing/unreadable" if miss
else "Loaded", source)
if not miss and source != "default config":
default_config_active = False
if default_config_active:
logger.warn("%s", "No config file found/readable - only default config is active")
_application_instance = Application(configuration)
if _application_config_path != config_path:
raise ValueError("RADICALE_CONFIG must not change: %r != %r" %

View file

@ -167,8 +167,14 @@ def run() -> None:
log.set_level(cast(str, configuration.get("logging", "level")))
# Log configuration after logger is configured
default_config_active = True
for source, miss in configuration.sources():
logger.info("%s %s", "Skipped missing" if miss else "Loaded", source)
logger.info("%s %s", "Skipped missing/unreadable" if miss else "Loaded", source)
if not miss and source != "default config":
default_config_active = False
if default_config_active:
logger.warn("%s", "No config file found/readable - only default config is active")
if args_ns.verify_storage:
logger.info("Verifying storage")