feat: add cmpp inbound gateway listener

This commit is contained in:
hectorzhao
2026-07-07 16:19:14 +08:00
parent ad3b86ba0a
commit cc628d0214
14 changed files with 631 additions and 17 deletions
+14 -1
View File
@@ -7,6 +7,7 @@ import (
"cmpp-platform/gateway/internal/control"
"cmpp-platform/gateway/internal/health"
"cmpp-platform/gateway/internal/inbound"
)
func main() {
@@ -14,10 +15,22 @@ func main() {
if addr == "" {
addr = ":8090"
}
cmppAddr := os.Getenv("GATEWAY_CMPP_ADDR")
if cmppAddr == "" {
cmppAddr = ":17890"
}
apiBaseURL := os.Getenv("API_BASE_URL")
go func() {
log.Printf("cmpp gateway inbound server listening on %s", cmppAddr)
if err := (inbound.Server{Addr: cmppAddr, APIBaseURL: apiBaseURL}).ListenAndServe(); err != nil {
log.Fatalf("gateway inbound server stopped: %v", err)
}
}()
mux := http.NewServeMux()
mux.Handle("/health", health.Handler())
control.Register(mux, control.Server{APIBaseURL: os.Getenv("API_BASE_URL")})
control.Register(mux, control.Server{APIBaseURL: apiBaseURL})
log.Printf("cmpp gateway control server listening on %s", addr)
if err := http.ListenAndServe(addr, mux); err != nil {