]> git.ipfire.org Git - dbl.git/commitdiff
api: Create some basic (empty) API service
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Dec 2025 13:40:12 +0000 (13:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Dec 2025 13:40:12 +0000 (13:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
configure.ac
src/dnsbl/api/__init__.py [new file with mode: 0644]

index 5bfca6a70209f81db0b556fa632e869665c2cb3a..f14ddba31b30e6f8bb18e7a745d6fb15961b8bf4 100644 (file)
@@ -60,6 +60,11 @@ dist_pkgpython_PYTHON = \
        src/dnsbl/sources.py \
        src/dnsbl/util.py
 
+dist_pkgpython_api_PYTHON = \
+       src/dnsbl/api/__init__.py
+
+pkgpython_apidir = $(pkgpythondir)/api
+
 # ------------------------------------------------------------------------------
 
 CLEANFILES += \
index c4d710a67da671a36194762e12f2117d98ce2e70..e23326136a46e0538b276a20ff3f500ef9effe60 100644 (file)
@@ -54,6 +54,7 @@ AM_PATH_PYTHON([3.13])
 
 AX_PYTHON_MODULE([dns], [fatal])
 AX_PYTHON_MODULE([babel], [fatal])
+AX_PYTHON_MODULE([fastapi], [fatal])
 AX_PYTHON_MODULE([httpx], [fatal])
 AX_PYTHON_MODULE([rich], [fatal])
 AX_PYTHON_MODULE([sqlmodel], [fatal])
diff --git a/src/dnsbl/api/__init__.py b/src/dnsbl/api/__init__.py
new file mode 100644 (file)
index 0000000..d0ad10e
--- /dev/null
@@ -0,0 +1,38 @@
+###############################################################################
+#                                                                             #
+# dnsbl - A DNS Blocklist Compositor For IPFire                               #
+# Copyright (C) 2025 IPFire Development Team                                  #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program 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 General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+import fastapi
+
+# Import the backend
+from .. import Backend
+
+# Initialize the app
+app = fastapi.FastAPI(
+       title = "IPFire DNSBL API",
+
+       # Enable debug mode
+       debug = True,
+)
+
+# Initialize the backend
+app.state.backend = Backend(
+       config = "/etc/dnsbl.conf",
+       debug  = True,
+)