serverless-environment-solver v1.1.0
Serverless environment solver
Why should I need this plugin?
If you use a separate .env file for each environment and assign variables in the serverless.yml configuration, all the variables defined will be received by all your AWS Lambdas, even if the code doesn't use them. This plugin ensures that any AWS Lambdas created with the serverless framework receive only the environment variables that the code actually references.
Installation
You can install the package with npm or yarn:
npm install --save-dev serverless-environment-solver
or
yarn add --dev serverless-environment-solver
After that, add the plugin to your serverless.yml
file:
...
plugins:
- serverless-environment-solver
Languages and cloud providers support
Currently, only functions written in the following programming languages are supported:
- Javascript/Typescript
- Python
Currently, only the following cloud providers are supported:
- Amazon Web Services
Our expectation is to support all available languages in serverless functions across all public cloud providers. To achieve this, we would love to have your contribution.
Usage example
You can find an usage example inside the example folder, where two AWS lambdas are declared and an environment variable file is started. The plugin will automatically ensure that each lambda will only receive the environment variables that are used within the code.