Skip to content

Commit

Permalink
minor edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Utkarsh Shukla committed Dec 29, 2024
1 parent 01a9004 commit 1b81e73
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions internal/serviceconfig/service_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ func addDefaults(ctx context.Context, server *http.Server) {

func fixedIdentityAPIHandlerMaker(em EchoManager, routes Destinations, service IncomingServiceConfig) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
ep := SearchSpec{
Destination: service.Destination,
ServiceType: service.ServiceType,
ServiceName: service.DestinationService,
}
go runAPIHandler(em, routes, ep, w, r)
go func() {
ep := SearchSpec{
Destination: service.Destination,
ServiceType: service.ServiceType,
ServiceName: service.DestinationService,
}
go runAPIHandler(em, routes, ep, w, r)
}()
}
}

Expand Down Expand Up @@ -163,18 +165,20 @@ func extractEndpoint(r *http.Request) (agentIdentity string, endpointType string

func secureAPIHandlerMaker(em EchoManager, routes Destinations, service IncomingServiceConfig) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
agentIdentity, endpointType, endpointName, err := extractEndpoint(r)
if err != nil {
r.Body.Close()
w.WriteHeader(http.StatusBadRequest)
return
}
ep := SearchSpec{
Destination: agentIdentity,
ServiceType: endpointType,
ServiceName: endpointName,
}
go runAPIHandler(em, routes, ep, w, r)
go func() {
agentIdentity, endpointType, endpointName, err := extractEndpoint(r)
if err != nil {
r.Body.Close()
w.WriteHeader(http.StatusBadRequest)
return
}
ep := SearchSpec{
Destination: agentIdentity,
ServiceType: endpointType,
ServiceName: endpointName,
}
runAPIHandler(em, routes, ep, w, r)
}()
}
}

Expand Down

0 comments on commit 1b81e73

Please # to comment.