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

dotenv-safe

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv-safe

Load environment variables from .env and ensure they are defined

  • 9.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
80K
decreased by-54.06%
Maintainers
2
Weekly downloads
 
Created

What is dotenv-safe?

The dotenv-safe npm package is used to load environment variables from a .env file into process.env, ensuring that all necessary environment variables are defined and preventing the application from running if any required variables are missing. It extends the functionality of the dotenv package by adding a layer of safety and validation.

What are dotenv-safe's main functionalities?

Load Environment Variables

This feature loads environment variables from a .env file into process.env, ensuring that all required variables are defined. If any required variables are missing, it will throw an error and prevent the application from running.

require('dotenv-safe').config();

Validation of Required Variables

This feature allows you to specify an example .env file that lists all required environment variables. The package will validate that all variables in the example file are present in the actual .env file, ensuring that no required variables are missing.

require('dotenv-safe').config({ example: './.env.example' });

Custom Path for .env File

This feature allows you to specify custom paths for both the .env file and the example file. This is useful if your environment files are located in a different directory.

require('dotenv-safe').config({ path: './config/.env', example: './config/.env.example' });

Other packages similar to dotenv-safe

Keywords

FAQs

Package last updated on 26 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