feat: add cmpp inbound gateway listener
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user