added env REQUEST_URL

This commit is contained in:
Pedro Nasser
2016-08-15 23:37:30 -03:00
parent ddc34e7699
commit 06c3bb3949
3 changed files with 14 additions and 11 deletions

View File

@@ -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 {

View File

@@ -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
}

View File

@@ -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 {