middleware-manager/traefik_mode.go
hhftechnologies c459063475
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
Tests / Run Tests (push) Waiting to run
Tests / Lint (push) Waiting to run
Tests / Build (push) Blocked by required conditions
Add Traefik Manager module, UI and build
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.
2026-04-15 12:22:52 +05:30

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)
}
}