mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-11 13:47:05 +02:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user