import configparser
import logging
+import sqlmodel
# Initialize logging as early as possible
from . import logger
# Parse the configuration file
self.config = self.parse_config(config)
+ # Connect to the database
+ self.db = self.connect()
+
log.debug("DNS Blocklist Backend Initialized")
def parse_config(self, config=None):
return c
+ def connect(self):
+ """
+ Connect to the database
+ """
+ uri = self.config.get("database", "uri")
+
+ # Create the database engine
+ return sqlmodel.create_engine(uri)
+
def update_sources(self):
"""
Updates all sources