mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
added env REQUEST_URL
This commit is contained in:
@@ -17,11 +17,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
ID string
|
ID string
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
Route *models.Route
|
Route *models.Route
|
||||||
Payload string
|
Payload string
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
|
RequestURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Runner struct {
|
type Runner struct {
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ func (t *containerTask) Command() string { return "" }
|
|||||||
|
|
||||||
func (t *containerTask) EnvVars() map[string]string {
|
func (t *containerTask) EnvVars() map[string]string {
|
||||||
env := map[string]string{
|
env := map[string]string{
|
||||||
"PAYLOAD": t.cfg.Payload,
|
"PAYLOAD": t.cfg.Payload,
|
||||||
|
"REQUEST_URL": t.cfg.RequestURL,
|
||||||
}
|
}
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,11 +110,12 @@ func handleRunner(c *gin.Context) {
|
|||||||
for _, el := range routes {
|
for _, el := range routes {
|
||||||
if el.Path == route {
|
if el.Path == route {
|
||||||
run := runner.New(&runner.Config{
|
run := runner.New(&runner.Config{
|
||||||
Ctx: c,
|
Ctx: c,
|
||||||
Route: el,
|
Route: el,
|
||||||
Payload: string(payload),
|
Payload: string(payload),
|
||||||
Timeout: 30 * time.Second,
|
Timeout: 30 * time.Second,
|
||||||
ID: reqID,
|
ID: reqID,
|
||||||
|
RequestURL: c.Request.URL.String(),
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := run.Run(); err != nil {
|
if err := run.Run(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user