serverless-offline-variables
is a lightweight plugin to replace ${cf:}, ${s3:}, ${ssm:} and ${env:}
parameters during the local (offline) runs, which can be very useful when testing microservices in isolation.
Use yarn
or npm
to add the plugin to your package dependecies:
npm install --save-dev serverless-offline-variables
or
yarn add serverless-offline-variables --dev
- Add plugin to you serverless plugins
plugins:
...
- serverless-offline-variables
- Configure plugin (optional)
custom:
...
offline-variables:
stages:
- local # Default
file: .env # Default
variables: # Optional
- ssm:hello-world: my value
By default plugin will first try to locate your variable in .env
file
(or in the file you specified), and only then under the variables
section.
If serverless-offline-variables
fails to locate a variable it falls back
to original resolver.
You are welcome to create pull requests to improve the project. Please check out the contribution quick guide to get started.
The project is distributed under MIT license.