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

envpub

v1.0.2

Published

a configurable local environment to connect to a remote one

Downloads

4

Readme

Env Public

Purpose

This application was built to make sharing of a public env file possible with the ability to generate a local .env from a shared .envpub file. It was also built to make local development easier with a wrapper command for nodemon and any script, it will decrypted variables injected after password prompt.

Installation

This application should be install globally but could possibly be run locally if needed. This has only currently been testing in nodejs 16 but should work for anything newer and may work for older versions.

npm install -g envpub

Features

This application allows for variables to be stored in the following format.

  • unencrypted, private, name shared (json format)
  • encrypted and shared, name shared (json format)
  • encrypted and private, name shared (json format)
  • unencrypted, private, name not shared (plain text and only in .env file)

The application allows you to run a web application using nodemon, the below app.js is an express application in your current application and password will only be prompted when starting the application.

envpub web app.js

The application allows you to run a node script or any script with decrypted environment variables. Be aware if require optional parameters for your script .e.g --test then you will need to add -- as an argument before it

envpub app node app.js parameter1 parameter2
envpub app node app.js parameter1 -- --optional test
envpub app app.sh

Getting started

  • Install the envpub application as shown above.
  • run envpub init on the command line in your application directory.
  • if you already have a .envpub it will generate your .env from it, if not it will generate one from scratch.

How it works

The application works by managing two files, a .env file which should be git ignored and .envpub which you would want to commit with your repository. the only difference between the two is that the private name shared variables values will not be saved in the .envpub file, it will be saved as an empty string. The algorythm used for the encryption is aes-192-cbc.

Example .env file

MY_SHARED_ENCRYPTED={"encrypted":true,"private":false,"value":"375b12b3ff40caae28e450b78f98480d","iv":"e6f270264efedfcc8d644168c22e79e7","salt":"4a16509b-e99d-4b3a-b5b8-a49f153b22dd"}
MY_SHARED_PRIVATE={"encrypted":false,"private":true,"value":"Testing Testing 123"}
MY_SHARED_ENCRYPTED_PRIVATE={"encrypted":true,"private":true,"value":"375b12b3ff40caae28e450b78f98480d","iv":"e6f270264efedfcc8d644168c22e79e7","salt":"4a16509b-e99d-4b3a-b5b8-a49f153b22dd"}
MY_PRIVATE_ONLY=Only stored in env file

Example .envpub file

MY_SHARED_ENCRYPTED={"encrypted":true,"private":false,"value":"375b12b3ff40caae28e450b78f98480d","iv":"e6f270264efedfcc8d644168c22e79e7","salt":"4a16509b-e99d-4b3a-b5b8-a49f153b22dd"}
MY_SHARED_PRIVATE={"encrypted":false,"private":true,"value":""}
MY_SHARED_ENCRYPTED_PRIVATE={"encrypted":true,"private":true,"value":"","iv":"e6f270264efedfcc8d644168c22e79e7","salt":"4a16509b-e99d-4b3a-b5b8-a49f153b22dd"}

As you can see from above anything that is set as private will have a blank value in the .envpub file. The adding, updating and deleting of variables is all managed by the envpub command line application, you will be prompted for what to enter by the application. if you are not sharing the name you can just add plain text variables to the .env file manually.

envpub add 
envpub update
envpub delete

Also be aware that there is only a single password for the entire file if using encryption, this was done for simplicity. You can change a password by running the following command

envpub change-password

You can also performa a json dump with encrypted data in file by running the following command

envpub dump-data

It is also possible to encrypt and decrypt a string using the following commands, this is useful if you have had two people enter different passwords in the shared file and data has been merged as this would require you to extract the data out manually, coordination between team members is manual for the shared password.

envpub encrypt <string>
envpub decrypt <string>

You should also backup your data in keepass or a similar application in case of loss as this application is provided as is no assurances are made to its accuracy.