From 5a0a1189709e2b451fa47080fe0d7e237e0bbd58 Mon Sep 17 00:00:00 2001 From: ldreano <31757360+ldreano@users.noreply.github.com> Date: Fri, 8 Sep 2017 12:59:19 +0200 Subject: [PATCH] update readme to add --processenv option --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 5035d61..fbf187a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,13 @@ Your Lambda function should have a package.json which you can modify to add a te "test": "run-local-lambda --file index.js --event tests/event.json --timeout 3" } ``` +To add some environment variables to your test script, you can add --processenv so: + +```js +"scripts": { + "test": "run-local-lambda --file index.js --event tests/event.json -- processenv tests/envir.json --timeout 3" +} +``` Finally, you can invoke your test by simply running: @@ -50,6 +57,7 @@ This module accepts the following parameters which are all optional. * --event [event file name] - Event data file name. Default: event.json * --handler [handler name] - Lambda function handler. Default: handler * --timeout [timeout seconds] - The timeout in seconds. Default: 3 +* --processenv [environment file name] - Environment data file name. Default: blank (optional) ### Context The context object provides the following public methods: @@ -104,6 +112,14 @@ The event data file can be provided using the --event parameter. An event is jus ] } ``` +### Environment +The environment data file can be provided using the --processenv parameter. An event is just a JSON object such as: + +```js +{ + "BUCKET":"" +} +``` See this [AWS documentation](http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-upload-deployment-pkg.html) for more information on testing Lambda functions manually.