diff options
author | Aleš Mrázek <ales.mrazek@nic.cz> | 2024-12-27 16:02:51 +0100 |
---|---|---|
committer | Aleš Mrázek <ales.mrazek@nic.cz> | 2025-01-14 09:48:01 +0100 |
commit | 2a709c5c2c20f1837ac69920fb688c2fd1f74475 (patch) | |
tree | 83cd3dc8c72ff1099d7a907a135e34a47e90f7e5 | |
parent | Merge !1641: Request prioritization (defer) (diff) | |
download | knot-resolver-2a709c5c2c20f1837ac69920fb688c2fd1f74475.tar.xz knot-resolver-2a709c5c2c20f1837ac69920fb688c2fd1f74475.zip |
manager: files: added files_reload callback
Now it will only reload the TLS cert files.
-rw-r--r-- | python/knot_resolver/manager/files/__init__.py | 3 | ||||
-rw-r--r-- | python/knot_resolver/manager/files/reload.py | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/python/knot_resolver/manager/files/__init__.py b/python/knot_resolver/manager/files/__init__.py index 49700656..29fbc741 100644 --- a/python/knot_resolver/manager/files/__init__.py +++ b/python/knot_resolver/manager/files/__init__.py @@ -1,3 +1,4 @@ +from .reload import files_reload from .watchdog import init_files_watchdog -__all__ = ["init_files_watchdog"] +__all__ = ["files_reload", "init_files_watchdog"] diff --git a/python/knot_resolver/manager/files/reload.py b/python/knot_resolver/manager/files/reload.py new file mode 100644 index 00000000..6dfd5874 --- /dev/null +++ b/python/knot_resolver/manager/files/reload.py @@ -0,0 +1,17 @@ +import logging + +from knot_resolver.controller.registered_workers import command_registered_workers +from knot_resolver.datamodel import KresConfig + +logger = logging.getLogger(__name__) + + +async def files_reload(config: KresConfig) -> None: + cert_file = config.network.tls.cert_file + key_file = config.network.tls.key_file + + if cert_file and key_file: + logger.info("TLS cert files reload triggered") + + cmd = f"net.tls('{cert_file}', '{key_file}')" + await command_registered_workers(cmd) |