Serverless JSON Environment Plugin
Merge a JSON file with your provider or functions environment objects.
Requirements:
- Serverless v1.12.x or higher.
- AWS provider
How it works
JSON Environment plugin will parse and merge with your environment objects whatever JSON string you pass. This plugin is useful to use with the new S3 variables syntax avoiding the hassle to add individually all environment Key/Value to S3.
Setup
Install via npm in the root of your Serverless service:
npm install serverless-plugin-jsonenv --save-dev
- Add the plugin to the
plugins
array in your Serverlessserverless.yml
:
plugins: - serverless-plugin-jsonenv
- Add
environmentJSON: ${s3:myBucket/myEnvironment.json}
property toprovider
orfunction
:
provider: environmentJSON: ${s3:myBucket/providerEnvironment.json}
functions: hello: environmentJSON: ${s3:myBucket/helloEnvironment.json}
- All done! JSON Environment will run on SLS
deploy
andinvoke local
commands
Contribute
Help us making this plugin better and future proof.
- Clone the code
- Install the dependencies with
npm install
- Create a feature branch
git checkout -b new_feature
- Lint with standard
npm run lint
License
This software is released under the MIT license. See the license file for more details.