]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
python: config: added KresConfig class and prepared Lua templates docs-python-refac-ga7je5/deployments/8788 python-refactoring
authorAleš Mrázek <ales.mrazek@nic.cz>
Mon, 16 Feb 2026 15:15:47 +0000 (16:15 +0100)
committerAleš Mrázek <ales.mrazek@nic.cz>
Thu, 26 Mar 2026 13:13:29 +0000 (14:13 +0100)
python/knot_resolver/config/__init__.py
python/knot_resolver/config/config.py [new file with mode: 0644]
python/knot_resolver/config/templates/__init__.py
python/knot_resolver/config/templates/loader.lua.j2 [new file with mode: 0644]
python/knot_resolver/config/templates/worker.lua.j2 [new file with mode: 0644]

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..12061c0b74e9da788a8272764947e89a2058cd6e 100644 (file)
@@ -0,0 +1,5 @@
+from .config import KresConfig
+
+__all__ = [
+    "KresConfig",
+]
diff --git a/python/knot_resolver/config/config.py b/python/knot_resolver/config/config.py
new file mode 100644 (file)
index 0000000..cf75c69
--- /dev/null
@@ -0,0 +1,11 @@
+from __future__ import annotations
+
+from .templates import LOADER_TEMPLATE, WORKER_TEMPLATE
+
+
+class KresConfig:
+    def render_lua_worker(self) -> str:
+        return WORKER_TEMPLATE.render(cfg=self)
+
+    def render_lua_loader(self) -> str:
+        return LOADER_TEMPLATE.render(cfg=self)
index 3bcdefd7ab6a351ab77f4fea3ad41ebcfa9583c0..606d41ef61a164f8c2cacfec03d16ced2a9e9f3f 100644 (file)
@@ -31,3 +31,7 @@ def _import_template(template: str) -> Template:
 
 
 SUPERVISORD_TEMPLATE: Template = _import_template("supervisord.conf.j2")
+
+WORKER_TEMPLATE: Template = _import_template("worker.lua.j2")
+
+LOADER_TEMPLATE: Template = _import_template("loader.lua.j2")
diff --git a/python/knot_resolver/config/templates/loader.lua.j2 b/python/knot_resolver/config/templates/loader.lua.j2
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/python/knot_resolver/config/templates/worker.lua.j2 b/python/knot_resolver/config/templates/worker.lua.j2
new file mode 100644 (file)
index 0000000..e69de29