]> git.ipfire.org Git - dbl.git/commitdiff
backend: Support passing the configuration as a path
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Dec 2025 13:36:56 +0000 (13:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Dec 2025 13:36:56 +0000 (13:36 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/dnsbl/__init__.py

index 5b5f0434ae64f26c7cf6961ce86b3b33476cd470..dc67c80c4e7b52b753b9c44549c0fc73f4227b78 100644 (file)
@@ -21,6 +21,7 @@
 import configparser
 import functools
 import httpx
+import io
 import logging
 import sqlmodel
 
@@ -56,7 +57,10 @@ class Backend(object):
 
                # Parse the file
                if config:
-                       c.read_file(config)
+                       if isinstance(config, io.RawIOBase):
+                               c.read_file(config)
+                       else:
+                               c.read([config])
 
                return c