npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

load-env-settings

v1.1.0

Published

Load application settings from file .env

Readme

load-env-settings

load-env-settings is a zero-dependency module that loads environment variables from a .env file into a global variable.

Install

npm install load-env-settings

Usage

Create a .env file in the root of your project:

ADMIN_USER=YOUR_ADMIN_USER
SECRET_KEY=ULTRASECRETKEY

As early as possible in your application, import and configure the package:

require( 'load-env-settings' ).load()

load( [ settings[, nameGlobal[, allowAny ] ] ] )

  • settings: (Object) Object with info about expected settings. If a setting included in this argument does not appear in .env file (or the file does not exist), it will be saved in the global variable with their default value. The key of each setting will be their name in the global variable. Each expected setting can contain a env (name of setting in .env file), a type (type of value of setting), a defaultValue (default value of setting) and a allowEmpty (if it is not allowed, empty settings use their default value) properties. More information in Settings. Defaults: {}
  • nameGlobal: (String) The name of the global variable that save the settings. Default AppSettings
  • allowAny: (Boolean) Enable any setting in .env file is allowed. If is false, only settings defined in settings will be saved in the global variable. Otherwise, the settings in .env file that are not in settings will be saved in the global variable with their name in .env file. Default false

Settings

settings is an object whose elements are the data of each expected settings. The key of each setting will be their name in the global variable.

  • [Required] env: (Object) Name of setting in .env file.
  • type: (String) Type of value of setting. Possible values: string, integer, number, boolean. Defaults: string
  • defaultValue: (Any) Default value of setting. It can be used when setting does not exist in .env file, when the parse of value has an error or when the value of setting in .env file is empty and allowEmpty is false. Defaults: null
  • allowEmpty: (Boolean) Enable values of settings in .env file can have empty string. Defaults: false
{
    name_setting: {
        env: "{ Name in .env file }"
        type: "string",
        defaultValue: null,
        allowEmpty: false
    }
}