Add Certificates page and Traefik API frontend client
This commit is contained in:
parent
9e4c612dcb
commit
7fc90524b5
40 changed files with 6585 additions and 359 deletions
|
|
@ -11,6 +11,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/traefik/traefik-gui/backend/internal/api"
|
||||
"github.com/traefik/traefik-gui/backend/internal/auth"
|
||||
"github.com/traefik/traefik-gui/backend/internal/config"
|
||||
"github.com/traefik/traefik-gui/backend/internal/database"
|
||||
"github.com/traefik/traefik-gui/backend/internal/traefik"
|
||||
|
|
@ -76,13 +77,29 @@ func main() {
|
|||
log.Fatalf("Failed to configure admin password: %v", err)
|
||||
}
|
||||
|
||||
traefikClient := traefik.NewMockClient()
|
||||
var traefikAPI traefik.TraefikAPI
|
||||
// Try to create real Traefik client if URL is provided and not in dev mock mode
|
||||
// For now, dev mode uses mock; production can set TRAEFIK_API_URL to real Traefik
|
||||
if cfg.TraefikAPIURL != "" && !cfg.DevMode {
|
||||
if client, err := traefik.NewClient(cfg.TraefikAPIURL); err == nil {
|
||||
traefikAPI = client
|
||||
log.Println("Using real Traefik API client at", cfg.TraefikAPIURL)
|
||||
} else {
|
||||
log.Printf("Failed to create Traefik client for %q: %v, falling back to mock", cfg.TraefikAPIURL, err)
|
||||
traefikAPI = traefik.NewMockAPIClient()
|
||||
}
|
||||
} else {
|
||||
traefikAPI = traefik.NewMockAPIClient()
|
||||
}
|
||||
|
||||
server := api.NewServer(cfg, db, traefikClient)
|
||||
server := api.NewServer(cfg, db, traefikAPI)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
// Start session cleanup background job (uses auth.SessionCleanupInterval)
|
||||
db.StartSessionCleanup(ctx, auth.SessionCleanupInterval)
|
||||
|
||||
go func() {
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue