Updated docs on configuration and required env vars. (#285)

* Updated docs on configuration and required env vars.

* minor
This commit is contained in:
Travis Reeder
2017-09-29 16:20:46 -07:00
committed by GitHub
parent ad7fe19da2
commit 5219227393
9 changed files with 117 additions and 41 deletions

View File

@@ -19,11 +19,16 @@ config:
key2: value2
keyN: valueN
headers:
content-type:
- text/plain
Content-Type: text/plain
build:
- make
- make test
expects:
config:
- name: SECRET_1
required: true
- name: SECRET_2
required: false
```
`name` is the name and tag to which this function will be pushed to and the
@@ -40,7 +45,7 @@ appended to the image as a tag.
'go', 'python', 'java', etc. The runtime 'docker' will use the existing Dockerfile if one exists.
`build` (optional) is an array of local shell calls which are used to help
building the function.
building the function. TODO: Deprecate this?
`type` (optional) allows you to set the type of the route. `sync`, for functions
whose response are sent back to the requester; or `async`, for functions that
@@ -56,9 +61,12 @@ and error message is logged. Default: `128`.
`headers` (optional) is a set of HTTP headers to be returned in the response of
this function calls.
`config` (optional) is a set of configurations to be passed onto the route
setup. These configuration options shall override application configuration
during functions execution.
`config` (optional) is a set of configuration variables to be passed onto the function as environment variables.
These configuration options shall override application configuration during functions execution. See [Configuration](developers/configs.md)
for more information.
`expects` (optional) a list of config/env vars that are required to run this function. These vars will be used when running/testing locally,
if found in your local environment. If these vars are not found, local testing will fail.
## Hot functions
@@ -67,31 +75,4 @@ hot functions support also adds two extra options to this configuration file.
`format` (optional) is one of the streaming formats covered at [function-format.md](function-format.md).
`idle_timeout` (optional) is the time in seconds a container will remain alive without receiving any new requests;
hot functions will stay alive as long as they receive a request in this interval. Default: `30`.
## Testing functions
`tests` (optional) is an array of tests that can be used to valid functions both
locally and remotely. It has the following structure
```yaml
tests:
- name: envvar
in: "inserted stdin"
out: "expected stdout"
err: "expected stderr"
env:
envvar: trololo
```
`in` (optional) is a string that is going to be sent to the file's declared
function.
`out` (optional) is the expected output for this function test. It is present
both in local and remote executions.
`err` (optional) similar to `out`, however it read from `stderr`. It is only
available for local machine tests.
`env` (optional) is a map of environment variables that are injected during
tests.
hot functions will stay alive as long as they receive a request in this interval. Default: `30`.