Files
smueller b335f6a497
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 9s
CI / Go — edge-gateway build (push) Successful in 17s
Phase8
2026-06-26 13:33:03 +02:00

39 lines
851 B
Go

package main
import (
"context"
"log/slog"
"os"
"os/signal"
"syscall"
"github.com/hexahost/gamecloud/edge-gateway/internal/config"
"github.com/hexahost/gamecloud/edge-gateway/internal/proxy"
)
func main() {
log := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelInfo,
}))
enabled := os.Getenv("EDGE_GATEWAY_ENABLED")
if enabled != "true" && enabled != "1" {
log.Info("edge gateway disabled",
"feature", "edge-gateway",
"hint", "set EDGE_GATEWAY_ENABLED=true to start the TCP join-to-start gateway",
)
return
}
cfg := config.Load()
gateway := proxy.New(cfg, log)
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
if err := gateway.ListenAndServe(ctx); err != nil {
log.Error("edge gateway stopped", "error", err)
os.Exit(1)
}
}