Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-export-env

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-export-env

Serverless plugin to export environment variables into a .env file

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.4K
increased by3.31%
Maintainers
1
Weekly downloads
 
Created
Source

⚡️ Serverless Export Env Plugin

serverless npm license dependencies

About

This Serverless plugin exports the environment variables defined in serverless.yml into a distinct .env file. This allows you to access these environment variables from local scripts such as for integration tests. You will find the .env file in the root folder of your project.

It will collect the global environment variables of the poject as well as all environment variables of the functions. It will also add API_ENDPOINT and IS_OFFLINE to your environment if you run the plugin via serverless offline.

Environment variables referencing CloudFormation resources (e.g. Ref: MyDynamoDbTable), or import values (e.g. Fn::ImportValue: MyExportedValue) are automatically resolved to their respective values. This, however, requires the stack to be deployed before the plugin can access any of these variables.

This plugin is based on the serverless-dotenv Plugin by Jimdo but largely rewritten to fit our needs.

Usage

Add the npm package to your project:

# Via yarn
$ yarn add arabold/serverless-export-env

# Via npm
$ npm install arabold/serverless-export-env --save-dev

Add the plugin to your serverless.yml:

plugins:
  - serverless-export-env

That's it! You can now call serverless export-env in your terminal to generate the .env file based on your Serverless configuration. Alternative you can just start serverless offline to generate it.

Provided lifecycle events

  • export-env:collect - Collect environment variables from Serverless
  • export-env:resolve - Resolve CloudFormation references and import variables
  • export-env:write - Write environment variables to file

Example

serverless export-env

This example will export all environment variables into a .env file in your project root folder.

Releases

1.0.0

  • This is the initial release with all basic functionality
  • TODO: Write some tests!

FAQs

Package last updated on 27 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc