mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Fns now annotated with invoke urls, as per triggers (#1172)
Clone of the trigger work to inject invoke urls into the annotations on a fn when it is returned from the server. Small changes to trigges code following code review of the fn code.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/fnproject/fn/api"
|
||||
@@ -9,11 +10,24 @@ import (
|
||||
|
||||
func (s *Server) handleFnGet(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
|
||||
f, err := s.datastore.GetFnByID(ctx, c.Param(api.ParamFnID))
|
||||
if err != nil {
|
||||
handleErrorResponse(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
app, err := s.datastore.GetAppByID(ctx, f.AppID)
|
||||
if err != nil {
|
||||
handleErrorResponse(c, fmt.Errorf("unexpected error - fn app not available: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
f, err = s.fnAnnotator.AnnotateFn(c, app, f)
|
||||
if err != nil {
|
||||
handleErrorResponse(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, f)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user