adds FN_FORMAT, APP_NAME and ROUTE to hot containers

This commit is contained in:
Reed Allman
2017-07-28 14:13:42 -07:00
parent 63796a7c48
commit 9ccd48eb18
2 changed files with 7 additions and 5 deletions

View File

@@ -373,7 +373,6 @@ func (hc *htfn) serve(ctx context.Context) {
} }
}() }()
cfg.Env["FN_FORMAT"] = cfg.Format
cfg.Timeout = 0 // add a timeout to simulate ab.end. failure. cfg.Timeout = 0 // add a timeout to simulate ab.end. failure.
cfg.Stdin = hc.containerIn cfg.Stdin = hc.containerIn
cfg.Stdout = hc.containerOut cfg.Stdout = hc.containerOut

View File

@@ -152,12 +152,15 @@ func (s *Server) serve(ctx context.Context, c *gin.Context, appName string, rout
} }
return "https" return "https"
}(), c.Request.Host, c.Request.URL.String()), }(), c.Request.Host, c.Request.URL.String()),
"CALL_ID": reqID, "CALL_ID": reqID,
"FORMAT": route.Format, "FN_FORMAT": route.Format,
} }
// TODO we could add... format, app_name, route from above (but nothing from the specific request) // baseVars are the vars on the route & app, not on this specific request [for hot functions]
baseVars := make(map[string]string, len(app.Config)+len(route.Config)) baseVars := make(map[string]string, len(app.Config)+len(route.Config)+3)
baseVars["FN_FORMAT"] = route.Format
baseVars["APP_NAME"] = appName
baseVars["ROUTE"] = route.Path
// app config // app config
for k, v := range app.Config { for k, v := range app.Config {