1.0.0 • Published 2 years ago

@henrycunh/ev v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

ev

a tool for versioning, securing and easily sharing environment variables

Features

  • Version control - allows for storing environment variables securely in git
  • 🔑 Secure - uses a single secret to secure your variables
  • 🧑‍💻 Easy sharing - sharing the secret means sharing your variables
  • 🛠 Great DX - tools for easily managing variables

Getting started

Initializing

Install Node >= 14 and run:

npx ev

It will prompt you for a new secret key and create two new files:

  • .ev/vars - where your environment variables are encrypted and safely stored,
  • .ev/secret - your secret key, whose must not be version controlled

And add .ev/secret to .gitignore

You can install ev globally (so you wont have to prepend npx) by running,

npm install -g @henrycunh/ev

Commands

ev MY_KEY=VALUE OTHER_KEY=OTHER_VALUE

This will add the MY_KEY and OTHER_KEY variables, if the variables already exists, their value will be overrided

You can test it by running

ev TEST=123 && ev | source && echo $TEST

This should print Added 1 variables. followed by 123.

ev change-secret -e production

Changes the default secret on the production environment

Using in your project

After initializing and setting a secret, you can just load from your previous .env file with the command ev load .env and run either ev | source or eval $(ev) to export the variables into the environment.

Passing a secret through a environment variable

In a CI environment, you want your secret to be passed through an environment variable set by your CI system. You can do this by setting the EV_SECRET variable

EV_SECRET=my-secret eval $(npx ev)

Javascript projects

You can add a pre script to your package.json file to load the variables into the environment before your development script runs. Here's an example:

{
  "scripts": {
    "predev": "eval $(ev)",
    "dev": "..."
  }
}

You can even create different scripts for different environments

{
  "scripts": {
    "predev:staging": "eval $(ev -e staging)",
    "dev:staging": "..."
  }
}
1.0.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.0.3

2 years ago