mirror of
https://github.com/hhftechnology/middleware-manager.git
synced 2026-07-22 14:23:25 +00:00
Introduce a standalone Traefik Manager mode and SPA: new internal/traefikmanager package (config, helpers, files, settings, runtime, handlers, server, types) with tests and supporting testdata; add a new React/TypeScript SPA under traefik-ui/ (components, pages, build config, tests). Update build & packaging: modify Dockerfile to build the traefik-ui app and include it in the final image, add new Makefile targets for building/running both UIs and modes, and add a traefik-manager service to docker-compose (with MODE env). Add runtime config loading and README docs for the new MODE, plus .gitignore entries for traefik-ui artifacts. Small updates to main.go and added traefik_mode.go.
39 lines
1 KiB
Go
39 lines
1 KiB
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
tmconfig "github.com/hhftechnology/middleware-manager/internal/traefikmanager/config"
|
|
tmserver "github.com/hhftechnology/middleware-manager/internal/traefikmanager/server"
|
|
)
|
|
|
|
func startTraefikManager(debug bool) {
|
|
cfg := tmconfig.LoadRuntimeConfig(debug)
|
|
files, err := tmconfig.NewFileStore(cfg)
|
|
if err != nil {
|
|
log.Fatalf("Failed to initialize Traefik Manager file store: %v", err)
|
|
}
|
|
settings := tmconfig.NewSettingsStore(cfg)
|
|
dashboard := tmconfig.NewDashboardStore(cfg)
|
|
client := &http.Client{Timeout: cfg.HTTPClientTimeout}
|
|
server := tmserver.New(cfg, files, settings, dashboard, client)
|
|
|
|
stop := make(chan os.Signal, 1)
|
|
signal.Notify(stop, os.Interrupt, syscall.SIGTERM)
|
|
|
|
go func() {
|
|
if err := server.Start(); err != nil && err != http.ErrServerClosed {
|
|
log.Fatalf("Traefik Manager server error: %v", err)
|
|
}
|
|
}()
|
|
|
|
<-stop
|
|
log.Println("Shutting down Traefik Manager...")
|
|
if err := server.Stop(); err != nil {
|
|
log.Printf("Traefik Manager shutdown error: %v", err)
|
|
}
|
|
}
|