fn: applications should be aware of reserved writable space (#1083)

Similar to FN_MEMORY, we pass FN_TMPSIZE to function config.
This commit is contained in:
Tolga Ceylan
2018-07-03 16:04:48 -07:00
committed by GitHub
parent 84eed08247
commit 300fcd7d92
2 changed files with 2 additions and 0 deletions

View File

@@ -154,6 +154,7 @@ func buildConfig(app *models.App, route *models.Route) models.Config {
// TODO: might be a good idea to pass in: "FN_BASE_PATH" = fmt.Sprintf("/r/%s", appName) || "/" if using DNS entries per app
conf["FN_MEMORY"] = fmt.Sprintf("%d", route.Memory)
conf["FN_TYPE"] = route.Type
conf["FN_TMPSIZE"] = fmt.Sprintf("%d", route.TmpFsSize)
CPUs := route.CPUs.String()
if CPUs != "" {

View File

@@ -32,6 +32,7 @@ the function's format:
* `FN_TYPE` - the type for this call, currently 'sync' or 'async'
* `FN_MEMORY` - a number representing the amount of memory available to the call, in MB
* `FN_CPUS` - a string representing the amount of CPU available to the call, in MilliCPUs or floating-point number, eg. `100m` or `0.1`. Header is present only if `cpus` is set for the route.
* `FN_TMPSIZE` - a number representing the amount of writable disk space available under /tmp for the call, in MB
In addition to these, all config variables set on `app.config` or `route.config` will be populated into the environment exactly as configured, for example if `app.config = { "HAMMER": "TIME" }` your environment will be populated with `HAMMER=TIME`.