mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Adding Fn invoke endpoint that works just like triggers endpoint (#1168)
This commit is contained in:
@@ -196,6 +196,7 @@ type Server struct {
|
||||
lbReadAccess agent.ReadDataAccess
|
||||
noHTTTPTriggerEndpoint bool
|
||||
noHybridAPI bool
|
||||
noFnInvokeEndpoint bool
|
||||
appListeners *appListeners
|
||||
routeListeners *routeListeners
|
||||
fnListeners *fnListeners
|
||||
@@ -719,6 +720,14 @@ func WithoutHTTPTriggerEndpoints() Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithoutFnInvokeEndpoints optionally disables the fn direct invoke endpoints from a LB -supporting server, allowing extensions to replace them with their own versions
|
||||
func WithoutFnInvokeEndpoints() Option {
|
||||
return func(ctx context.Context, s *Server) error {
|
||||
s.noFnInvokeEndpoint = true
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithoutHybridAPI unconditionally disables the Hybrid API on a server
|
||||
func WithoutHybridAPI() Option {
|
||||
return func(ctx context.Context, s *Server) error {
|
||||
@@ -1125,7 +1134,11 @@ func (s *Server) bindHandlers(ctx context.Context) {
|
||||
lbRouteGroup.Use(s.checkAppPresenceByNameAtLB())
|
||||
lbRouteGroup.Any("/:appName", s.handleV1FunctionCall)
|
||||
lbRouteGroup.Any("/:appName/*route", s.handleV1FunctionCall)
|
||||
}
|
||||
|
||||
if !s.noFnInvokeEndpoint {
|
||||
lbFnInvokeGroup := engine.Group("/invoke")
|
||||
lbFnInvokeGroup.POST("/:fnID", s.handleFnInvokeCall)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user