From 06c3bb3949b0a3f3558cc8618a5e5af06fd3bf1e Mon Sep 17 00:00:00 2001 From: Pedro Nasser Date: Mon, 15 Aug 2016 23:37:30 -0300 Subject: [PATCH] added env REQUEST_URL --- api/runner/runner.go | 11 ++++++----- api/runner/task.go | 3 ++- api/server/runner.go | 11 ++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/api/runner/runner.go b/api/runner/runner.go index 591012e95..69293bff7 100644 --- a/api/runner/runner.go +++ b/api/runner/runner.go @@ -17,11 +17,12 @@ import ( ) type Config struct { - ID string - Ctx context.Context - Route *models.Route - Payload string - Timeout time.Duration + ID string + Ctx context.Context + Route *models.Route + Payload string + Timeout time.Duration + RequestURL string } type Runner struct { diff --git a/api/runner/task.go b/api/runner/task.go index e65b8134b..b0a8629fe 100644 --- a/api/runner/task.go +++ b/api/runner/task.go @@ -18,7 +18,8 @@ func (t *containerTask) Command() string { return "" } func (t *containerTask) EnvVars() map[string]string { env := map[string]string{ - "PAYLOAD": t.cfg.Payload, + "PAYLOAD": t.cfg.Payload, + "REQUEST_URL": t.cfg.RequestURL, } return env } diff --git a/api/server/runner.go b/api/server/runner.go index ba9e2f739..fef39e7e3 100644 --- a/api/server/runner.go +++ b/api/server/runner.go @@ -110,11 +110,12 @@ func handleRunner(c *gin.Context) { for _, el := range routes { if el.Path == route { run := runner.New(&runner.Config{ - Ctx: c, - Route: el, - Payload: string(payload), - Timeout: 30 * time.Second, - ID: reqID, + Ctx: c, + Route: el, + Payload: string(payload), + Timeout: 30 * time.Second, + ID: reqID, + RequestURL: c.Request.URL.String(), }) if err := run.Run(); err != nil {