@nicholaskuchiniski/serverless-dotenv-plugin
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@nicholaskuchiniski/serverless-dotenv-plugin

Create .env files on your serverless function using serverless.yaml definition

npm version Run tests

Why ?

The main objective of this library is to get out of the lambda limit 4KBs problem, using the serverless.yaml definitions to assemble the .env file (allowing to get variables through SSM, etc.). Keep in mind that putting a .env in your lambda, also means putting all your environment variables in a readable way inside your lambda .zip, so be careful.

Usage

  • Install the plugin with yarn add -D @nicholaskuchiniski/serverless-dotenv-plugin

  • Add the plugin on you serverless.yaml:

    plugins:
      - "@nicholaskuchiniski/serverless-dotenv-plugin"
  • Create a custom definition on your serverless.yaml:

    custom: 
      dotenv: 
        API_URL: http://api-url.example.com
  • Run serverless dotenv, a .env file will be created on the root your actual directory and serverless will put it inside your lambda (is important to have dotenv propertly configured inside your code)

Example

Inside the main repository, a /example exists with a simple serverless function that shows a value from the .env file.

Package Sidebar

Install

npm i @nicholaskuchiniski/serverless-dotenv-plugin

Weekly Downloads

0

Version

2.0.1

License

MIT

Unpacked Size

8.32 kB

Total Files

11

Last publish

Collaborators

  • nicholaskuchiniski