API improvements (#410)

* api improvements, remove global Api object and reduce gin dependency

* requested changes
This commit is contained in:
Pedro Nasser
2016-12-09 15:24:35 -02:00
committed by GitHub
parent 0c3c9ff2ee
commit 49a7712e6b
18 changed files with 126 additions and 107 deletions

View File

@@ -11,14 +11,14 @@ import (
"github.com/iron-io/runner/common"
)
func handleRouteGet(c *gin.Context) {
func (s *Server) handleRouteGet(c *gin.Context) {
ctx := c.MustGet("ctx").(context.Context)
log := common.Logger(ctx)
appName := c.Param("app")
routePath := path.Clean(c.Param("route"))
appName := ctx.Value("appName").(string)
routePath := path.Clean(ctx.Value("routePath").(string))
route, err := Api.Datastore.GetRoute(ctx, appName, routePath)
route, err := s.Datastore.GetRoute(ctx, appName, routePath)
if err != nil && err != models.ErrRoutesNotFound {
log.WithError(err).Error(models.ErrRoutesGet)