✨ A tool for versioning, securing and easily sharing environment variables

Overview

ev

a tool for versioning, securing and easily sharing environment variables


initializingcommandsusing in your project

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

Adding new variables →
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

Exporting variables into the environment →
ev | source
# you can alternatively use
eval $(ev)

This will export every variable into the environment

You can test it by running

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

This should print Added 1 variables. followed by 123.

Removing variables →
ev rm MY_KEY OTHER_KEY

This will remove the MY_KEY and OTHER_KEY variables

Listing variables →
ev ls

This will list all variables

ev ls MY_KEY

This will list the MY_KEY variable

Changing the secret key →
ev change-secret

This will prompt for the old key and the new one, if the old key is correct, it will re-encrypt the variables with the new one

Setting the secret key →

In case you mistype your secret, you can just run this to type the secret again

ev set-secret

This will prompt for the secret

Using different environments →

You can append the option --env (or -e) on any command to specify a different environment

ev -e staging MY_KEY=VALUE_IN_STAGING

The variables for each environment is stored in a different file

Loading variables from a .env file →
ev load .env

All the variables on .env will be loaded into the default environment

Setting a different secret for specific environments →
When using this tool, you may want to give access to staging/local environment variables but not to the production ones.
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": "..."
  }
}
You might also like...

🔑 Loads environment variables from .env for nodejs projects with safe

env-safe env-safe is module that loads that loads environment variables from a .env file into process.env with type-safe. And can also validate the ty

Dec 28, 2022

StarkNet support extension for VSCode. Visualize StarkNet contracts: view storage variables, external and view functions, and events.

StarkNet support extension for VSCode. Visualize StarkNet contracts: view storage variables, external and view functions, and events.

StarkNet Explorer extension This VSCode extension quickly shows relevant aspects of StarkNet contracts: Storage variables of the current contract, and

Nov 4, 2022

An action intended to run on pull request and post a comment summarizing any changes to DevCycle variables.

An action intended to run on pull request and post a comment summarizing any changes to DevCycle variables.

Overview With this Github action, information on which DevCycle features have been added or removed in a code change will be shown directly on each Pu

Jun 14, 2022

Palette plugin using CSS variables for TailwindCSS

 Palette plugin using CSS variables for TailwindCSS

Palette plugin using CSS variables for TailwindCSS Adds a color palette (from 100 to 900) for each color of your tailwind configuration while using CS

Dec 28, 2022

A JavaScript library to apply light-dark theme in web pages with the help of css variables

A JavaScript  library to apply light-dark theme in web pages with the help of css variables

Theme Changer The simplest JavaScript library to apply light - dark theme in your website. First Check Out One Example How to use Files index.html sty

Dec 20, 2022

Beautiful UI-Range input component, highly customisable, based on CSS variables.

Beautiful UI-Range input component, highly customisable, based on CSS variables.

Beautiful UI-Range input component, highly customisable, based on CSS variables. including a floating output value, min & max values on the sides & ticks according to the steps

Dec 27, 2022

Read Storage Variables On-The-Go

EVM-Storage-Slot-Reader Read Storage Variables On-The-Go TODO basic types ☑️ 🔲 static arrays (1D) ☑️ 🔲 dynamic arrays (1D) ☑️ 🔲 bytes 🔲 🔲 mapping

Nov 28, 2022

⚡ A multipurpose meme marketplace and editor for creating, downloading and sharing memes with a ready to use API powered by Hasura GraphQL

⚡ A multipurpose meme marketplace and editor for creating, downloading and sharing memes with a ready to use API powered by Hasura GraphQL

Rocketmeme A multipurpose meme marketplace and editor for creating and downloading memes. View meme collection, browse different meme categories, like

Nov 18, 2022
Comments
  • feat: add environment scoped secrets

    feat: add environment scoped secrets

    what

    • Added environment support to change-secret and set-secret commands

    why

    It enables developers to scope access to different environments, which may prove useful in production workloads, with secrets embedded directly into its' container through environment variables.

    opened by henrycunh 1
  • fix: correct the `change-secret` command behavior

    fix: correct the `change-secret` command behavior

    what

    It was always comparing with the secret for the default environment, this PR fixes this behavior.

    All the environments were having their variables files rewritten with a new secret, when the user didn't specify an environment as well.

    opened by henrycunh 0
  • Package and release binaries

    Package and release binaries

    Use vercel/pkg to package binaries to the following platforms

    • [ ] Windows (node16-win-x64)
      • Release to scoop
    • [ ] MacOS (node16-macos-x64 node16-macos-arm64)
      • Release to homebrew
    • [ ] Linux (node-alpine-x64 node-linux-x64)
      • Release to apt apk pacman
    opened by henrycunh 0
Releases(1.0.0)
Owner
henrycunh
tech lead @ clicampo
henrycunh
Snippets for securing, transforming, and optimizing GraphQL APIs.

StepZen Snippets Welcome! StepZen is a unique and declarative way to build & run any-sized Graph in minutes. Explore the docs View Demo Report Bug Req

StepZen 13 Nov 9, 2022
mirrord lets you easily mirror traffic from your production environment to your development environment.

mirrord lets you easily mirror traffic from your Kubernetes cluster to your development environment. It comes as both Visual Studio Code extension and a CLI tool.

MetalBear 2.1k Dec 24, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A file sharing service, where you can upload files and provide a download link for anyone on the internet by sharing the link 🔗 or via mail ✉️ which remains active for 24hours 🕙.

eShare | File Sharing App A file sharing service, where you can upload files and provide a download link for anyone on the internet by sharing the lin

Akhil Bhalerao 7 Nov 20, 2022
A package to enable feature-flag support on Next.js via cookies and environment variables

next-feature-flags Add support for feature flags on Next.js based on cookies + environment variables. How it works It reads from cookies and Next.js's

Alexandre Santos 10 Aug 10, 2022
A custom action for setting GitHub Workflow environment variables with YAML configuration files.

yaml-env-action - A custom action for setting GitHub Workflow environment variables with YAML configuration files. Introduction yaml-env-action is a c

Piper Dougherty 3 Dec 13, 2022
Displays environment variables on your Grafana dashboards

Displays environment variables on your Grafana dashboards Introduction The Environment data source is a plugin for Grafana that returns environment va

Volkov Labs 7 Dec 26, 2022
Loads environment variables from .env for nodejs projects.

dotenv Written in typescript, full testing. It can loads environment variables from a .env file into process.env or parse <key>=<value> string Install

Berlin 102 Sep 23, 2022