Refactor the whole backend to support remote-fail2ban machines over ssh or over a agent-api(needs to be build)

This commit is contained in:
2025-11-12 15:52:34 +01:00
parent 995de09ce4
commit 9c3713bb41
21 changed files with 4263 additions and 440 deletions

View File

@@ -25,6 +25,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/swissmakers/fail2ban-ui/internal/config"
"github.com/swissmakers/fail2ban-ui/internal/fail2ban"
"github.com/swissmakers/fail2ban-ui/internal/storage"
"github.com/swissmakers/fail2ban-ui/pkg/web"
)
@@ -32,6 +34,19 @@ func main() {
// Get application settings from the config package.
settings := config.GetSettings()
if err := storage.Init(""); err != nil {
log.Fatalf("Failed to initialise storage: %v", err)
}
defer func() {
if err := storage.Close(); err != nil {
log.Printf("warning: failed to close storage: %v", err)
}
}()
if err := fail2ban.GetManager().ReloadFromSettings(settings); err != nil {
log.Fatalf("failed to initialise fail2ban connectors: %v", err)
}
// Set Gin mode based on the debug flag in settings.
if settings.Debug {
gin.SetMode(gin.DebugMode)