diff --git a/README.md b/README.md index c39850f..5803e39 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,14 @@ AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION ``` -Alternatively, the values can be provided via a config file. A template is provided at `config/environment.yaml` which can be copied and then filled in with your AWS keys. The name of the file you use should be set in the `NODE_ENV` environment variable. For example, if you create a file `config/test.yaml` to hold your keys then you can test as follows: +Alternatively, the values can be provided via config files. This can be with a `.env` file that will set environment variables, as well as with a structured config file. + +If using a config file then a template is provided at `config/environment.yaml` which can be copied and then filled in with your AWS keys, and the name of the file you use will need to be set in the `NODE_ENV` environment variable. + +For example, if you create a file `config/test.yaml` to hold your keys and other configuration information then you can test as follows: ```shell -export NODE_ENV=test -mocha +NODE_ENV=test npm test ``` For more information on why that works, see the magical [config module](https://npmjs.org/package/config). diff --git a/lib/amqp-sqs.js b/lib/amqp-sqs.js index 8343b98..144eb18 100644 --- a/lib/amqp-sqs.js +++ b/lib/amqp-sqs.js @@ -2,6 +2,7 @@ * A wrapper around SQS that looks like AMQP. */ +require('dotenv').load(); require('../config/set_defaults'); var CONFIG = require('config'); diff --git a/package.json b/package.json index 12a4a05..57da010 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "dependencies": { "aws-sdk": "^2.1.36", "config": "^1.14.0", + "dotenv": "^1.2.0", "limiter": "~1.0.5", "lodash": "^3.10.0", "winston": "^1.0.1",