Skip to content

Commit

Permalink
Add --env to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-norwood committed Sep 20, 2018
1 parent 9fc463d commit 049b5b0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/providers/aws/cli-reference/invoke-local.md
Expand Up @@ -28,6 +28,7 @@ serverless invoke local --function functionName
- `--raw` Pass data as a raw string even if it is JSON. If not set, JSON data are parsed and passed as an object.
- `--contextPath` or `-x`, The path to a json file holding input context to be passed to the invoked function. This path is relative to the root directory of the service.
- `--context` or `-c`, String data to be passed as a context to your function. Same like with `--data`, context included in `--contextPath` will overwrite the context you passed with `--context` flag.
* `--env` or `-e` String representing an environment variable to set when invoking your function, in the form `<name>=<value>`. Can be repeated for more than one environment variable.

## Environment

Expand Down Expand Up @@ -94,6 +95,16 @@ serverless invoke local --function functionName --contextPath lib/context.json
```
This example will pass the json context in the `lib/context.json` file (relative to the root of the service) while invoking the specified/deployed function.

### Local function invocation, setting environment variables

```bash
serverless invoke local -f functionName -e VAR1=value1

# Or more than one variable

serverless invoke local -f functionName -e VAR1=value1 -e VAR2=value2
```

### Limitations

Currently, `invoke local` only supports the NodeJs, Python & Java runtimes.
Expand Down
11 changes: 11 additions & 0 deletions docs/providers/google/cli-reference/invoke-local.md
Expand Up @@ -28,6 +28,7 @@ serverless invoke -f functionName
* `--raw` Pass data as a raw string even if it is JSON. If not set, JSON data are parsed and passed as an object.
* `--contextPath` or `-x`, The path to a json file holding input context to be passed to the invoked function. This path is relative to the root directory of the service.
* `--context` or `-c`, String data to be passed as a context to your function. Same like with `--data`, context included in `--contextPath` will overwrite the context you passed with `--context` flag.
* `--env` or `-e` String representing an environment variable to set when invoking your function, in the form `<name>=<value>`. Can be repeated for more than one environment variable.

> Keep in mind that if you pass both `--path` and `--data`, the data included in the `--path` file will overwrite the data you passed with the `--data` flag.
Expand All @@ -54,3 +55,13 @@ serverless invoke local -f functionName -p path/to/file.json

serverless invoke local -f functionName -p path/to/file.yaml
```

### Local function invocation, setting environment variables

```bash
serverless invoke local -f functionName -e VAR1=value1

# Or more than one variable

serverless invoke local -f functionName -e VAR1=value1 -e VAR2=value2
```
11 changes: 11 additions & 0 deletions docs/providers/openwhisk/cli-reference/invoke-local.md
Expand Up @@ -25,6 +25,7 @@ __*Please note that only the JavaScript and Python runtimes are supported with t
- `--function` or `-f` The name of the function in your service that you want to invoke locally. **Required**.
- `--path` or `-p` The path to a json file holding input data to be passed to the invoked function. This path is relative to the root directory of the service. The json file should have event and context properties to hold your mocked event and context data.
- `--data` or `-d` String data to be passed as an event to your function. Keep in mind that if you pass both `--path` and `--data`, the data included in the `--path` file will overwrite the data you passed with the `--data` flag.
* `--env` or `-e` String representing an environment variable to set when invoking your function, in the form `<name>=<value>`. Can be repeated for more than one environment variable.

## Examples

Expand Down Expand Up @@ -60,6 +61,16 @@ serverless invoke local --function functionName --path lib/data.json

This example will pass the json data in the `lib/data.json` file (relative to the root of the service) while invoking the specified/deployed function.

### Local function invocation, setting environment variables

```bash
serverless invoke local -f functionName -e VAR1=value1

# Or more than one variable

serverless invoke local -f functionName -e VAR1=value1 -e VAR2=value2
```

### Limitations

Currently, `invoke local` only supports the NodeJs and Python runtimes.

0 comments on commit 049b5b0

Please sign in to comment.