Socket
Socket
Sign inDemoInstall

dotenv-expand

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv-expand

Expand environment variables using dotenv


Version published
Weekly downloads
16M
increased by1.15%
Maintainers
1
Weekly downloads
 
Created

What is dotenv-expand?

The dotenv-expand npm package is an extension for dotenv. It allows you to have more complex .env files by enabling variable expansion within your environment variables. This means you can reference other environment variables within your .env file, which dotenv by itself does not support.

What are dotenv-expand's main functionalities?

Variable Expansion

This feature allows you to reference other variables in your .env file. For example, if you have a BASE_URL variable, you can use it to construct the API_URL variable.

require('dotenv').config();
require('dotenv-expand')(process.env);

// .env file
// BASE_URL=https://myapi.com
// API_URL=${BASE_URL}/v1

Nested Variable Expansion

This feature allows for nested variable expansion where you can use multiple environment variables to construct a new one.

require('dotenv').config();
require('dotenv-expand')(process.env);

// .env file
// URL=https://myapi.com
// VERSION=v1
// API_URL=${URL}/${VERSION}

Other packages similar to dotenv-expand

Keywords

FAQs

Package last updated on 11 Feb 2024

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