From: Michael Tremer Date: Mon, 29 Dec 2025 13:40:12 +0000 (+0000) Subject: api: Create some basic (empty) API service X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b44eade968b764902aead64bef715d97a1c8bcab;p=dbl.git api: Create some basic (empty) API service Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 5bfca6a..f14ddba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 += \ diff --git a/configure.ac b/configure.ac index c4d710a..e233261 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 0000000..d0ad10e --- /dev/null +++ b/src/dnsbl/api/__init__.py @@ -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 . # +# # +############################################################################### + +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, +)