mux: run http server if gateway | grpcWeb | react | mux is defined

goroutines: use errgroup
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2023-07-08 01:29:18 +02:00
parent 36f3c5bc81
commit 1fa30d9706
5 changed files with 52 additions and 38 deletions

View File

@@ -22,9 +22,9 @@ func (s *service) gateway(opts ...runtime.ServeMuxOption) error {
return err
}
if s.opts.gatewayPrefix != "" {
s.opts.mux.Handle(s.opts.gatewayPrefix+"/", http.StripPrefix(s.opts.gatewayPrefix, wsproxy.WebsocketProxy(mux)))
s.lazyMux().Handle(s.opts.gatewayPrefix+"/", http.StripPrefix(s.opts.gatewayPrefix, wsproxy.WebsocketProxy(mux)))
} else {
s.opts.mux.Handle("/", wsproxy.WebsocketProxy(mux))
s.lazyMux().Handle("/", wsproxy.WebsocketProxy(mux))
}
return nil
}