New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@slsplus/dotenv

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slsplus/dotenv

Serverless Dotenv Component

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-58.33%
Maintainers
1
Weekly downloads
 
Created
Source

Serverless Dotenv Component

npm NPM downloads

Introduction

Inspired by serverless-dotenv-plugin.

Preload environment variables into serverless. If you have variables stored in a .env file that you want loaded into your serverless yaml config. This will allow you to reference them as ${Dotenv.env.VAR_NAME} inside your config(If you ).

Setup

Add @slsplus/dotenv in your serverless.yml, as below:

Dotenv:
  component: '@slsplus/dotenv'

Now create .env file in the project root:

TENCENT_SECRET_ID=xxx
TENCENT_SECRET_KEY=xxx

ABC=124

Automatic Env file name resolution

By default, the component looks for the file: .env. If you want different env files based on environment. For example:

.env.development
.env.production

Then you can exec deploy command like:

$ NODE_ENV=development serverless --debug

Or, like this:

$ serverless --debug --env development

Inject custom arguments to command

You can directly run deploy command with custom arguments:

$ serverless --debug --custom abc --custom1 123

Then you can use by process.env.custom and process.env.custom1

Options

Complete configuration in serverless.yml
# serverless.yml

Dotenv:
  component: '@serverless/dotenv-component'
  inputs:
    envFile: /path/to/my/.env
    envPath: /path/to/my/
    exclude:
      - SECRET
Configuration description
ParamRequired/OptionalTypeDefaultDescription
envFileOptionalString.envDotenv file
envPathOptionalStringprocess.cwd()Dotenv file path
excludeOptionalstring[]Variable in .env file, you don't want to expose

More Components

awesome-serverless-framework

License

Copyright (c) 2020 Serverless Plus

Keywords

FAQs

Package last updated on 26 Mar 2020

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