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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@qavajs/env

v1.0.0

Published

Loads environment variables from a .env and encrypted .env.enc file into process.env

Downloads

3

Readme

Env

The module decrypts and loads environment variables from a .env.enc file into process.env as well as variables from a .env.

Usage

As early as possible in your application, import and call loadConfig()

To upload variables only from .env file:

import loadConfig from '@qavajs/env'
// Load configuration from the default .env file
loadConfig();

// Load configuration from a specified *.env file
loadConfig({envConfigPath: 'path/to/local.env'});

// Load configuration from a default .env.enc encrypted file
loadConfig({password: 'mySecretPassword'});

// Load configuration from a specified *.env.enc encrypted file
loadConfig({encryptedConfigPath: 'path/to/config.env.enc', password: 'mySecretPassword'});

// Load configuration from both *.env and *.env.enc files
loadConfig({
    envConfigPath: 'path/to/local.env',
    encryptedConfigPath: 'path/to/local.env.enc',
    password: 'mySecretPassword'
});

CLI tools

The module has a commandline tool to encrypt and decrypt env files in order to provide capability to update .env.enc file according to changes through project. To encrypt default .env from the root folder run the next command in terminal:

npx qavajs-env encrypt 'mySecretPassword'

This command will generate .env.enc it the project root folder.

To encrypt an env file with specific name run the next:

npx qavajs-env encrypt 'mySecretPassword' -f 'path/to/my/named.env'

The file will be encrypted and saved into the directory.

Another feature is decrypting an .env.enc file. This can be helpful if you would like to obtain it's content.

npx qavajs-env encrypt 'mySecretPassword'

To decrypt an env.enc file from a specific directory run the next command:

npx qavajs-env encrypt 'mySecretPassword' -f 'path/to/my/named.env.enc'