Envful is a CLI tool that verifies the presence of environment variables

Overview

Envful 🌳

GitHub Workflow Status npm Crates.io

Envful is a CLI tool that verifies the presence of environment variables. It looks inside your .env file and the host system. You can use it to run any process while ensuring all the variables are set.

Never again waste time debugging your app because of a misconfigured environment.

Screen Shot 2022-01-23 at 10 13 06 p m

Installation

NPM

You can install Envful using NPM, allowing you to run it from your project's scripts.

npm install envful

crates.io

You can also install directly from crates.io using cargo.

cargo install envful

Usage

Envful uses the .env.example file as a manifest for which variables are needed. If your project has a .env.example it already supports envful! 🚀

Check for variables and undeclared variables using check:

envful check

You can also specify a command to run if check is successful using the '--' separator. It will immediately fail if a variable is missing, showing helpful messages.

envful -- echo "I am envful!"

envful -- npm run dev
USAGE:
    envful [OPTIONS] 
   
    

OPTIONS:
    -d, --dir 
   
       Directory to look for .env and .env.example files. Defaults to current directory.
    -h, --help         Print help information
    -V, --version      Print version information

SUBCOMMANDS:
    check    Check if env has all required variables and warns if missing
    help     Print this message or the help of the given subcommand(s)

  

How to declare variables

Inside your .env.example file, you can declare the variables that your application requires. You can use the triple hash market (###) to add a description to the variable. Add [optional] to a variable for warning instead of failing.

Example:

### The URL to the database instance
DATABASE_URL=

### The app secret used to sign JSON Web Tokens
APP_SECRET=

### Google Analytics ID [optional]
GA_ID=

Contributions welcome

This project welcomes contributions of any kind, whether you want to add new features, improve the documentation or just want to give some feedback.

License

Envful is published under the MIT license. See the LICENSE file for more information.

Comments
  • Add options to allow defining the env file and the example file to look for

    Add options to allow defining the env file and the example file to look for

    I think would be great if we could customize the following two values

    https://github.com/arvindell/envful/blob/7771ea94f9c678fb9c241d0594e973073979fa77/src/checker.rs#L12-L13

    my use case: I have multiple .env files, one for each environment like .development.env & .development.env.example. Thus, I cannot use this cool tool :disappointed:

    my proposal: --example <path/to/.env.example> and --path <path/to/.env>

    enhancement 
    opened by micalevisk 3
  • Add support for show-optional and show-undeclared

    Add support for show-optional and show-undeclared

    This PR adds support for two new flags to the run command: --show-optional and --show-undeclared.

    These are useful if a team decides they want to be warned even on cases that do not exit the process with an error code.

    opened by arvindell 0
  • Add --init option to bootstrap .env

    Add --init option to bootstrap .env

    This feature proposes adding a --init flag to envful to allow bootstrapping a .env file with the required and optional keys. The default values specified in .env.example will be used where possible.

    This would make it much faster to end up with a valid environment

    opened by arvindell 0
  • Warn on duplicate value for variable

    Warn on duplicate value for variable

    This feature proposes adding a warning/error on the case that a user's environment defines two variables with the same name. For example:

    
    NEXT_PUBLIC_API_URL=http://localhost:4000
    SOME_OTHER_VARS=12345
    
    
    NEXT_PUBLIC_API_URL=https://api.quentli.com
    
    

    This could catch situations in a user runs runs a process with an unintended env.

    enhancement 
    opened by arvindell 3
  • Environment wizard

    Environment wizard

    It would be a cool feature to have a command that initiates a "wizard" asking you for the required and optional variables given a manifest file (.env.example). This would then create a .env file with the provided values. No more manual copy/paste.

    enhancement 
    opened by arvindell 1
  • Display the description on missing vars report

    Display the description on missing vars report

    Let's say we have a .env.example with this content:

    ### The URL to the database instance
    DATABASE_URL=
    
    ### The app secret used to sign JSON Web Tokens
    APP_SECRET=
    
    ### Google Analytics ID [optional]
    GA_ID=
    

    and the .env one has this:

    DATABASE_URL=
    APP_SECRET=
    GA_ID=
    

    I think would be cool if the check command displays the description of missing ones like

    Checking environment...
    The process is missing required environment variables:
    ❌ Missing variable: DATABASE_URL
    ℹ️ The URL to the database instance
    ❌ Missing variable: GA_ID
    ℹ️ The app secret used to sign JSON Web Tokens
    
    enhancement 
    opened by micalevisk 5
Releases(v1.0.7)
Owner
Alex Vilchis
Co-founder at Quentli | Making online billing simple & seamless in Latam | 📖 🍣 🎮 💻
Alex Vilchis
A Rust-based Garry's Mod module for fetching environment variables.

gm_environ Using Environment Variables in Garry's Mod. Installation Download a copy of the module from the releases (or compile from source) Move the

Joshua Piper 2 Jan 4, 2022
Set Shell Environment Variables across multiple shells with a single configuration file.

Xshe – Cross-Shell Environment Vars xshe allows for setting Shell Environment Variables across multiple shells with a single TOML configuration file.

Ethan Kinnear 9 Dec 16, 2022
🚀 Discord Rich Presence plugin for Neovim written in Rust

?? Cord ?? Cord is a Discord Rich Presence plugin designed for Neovim, written in Rust. ?? Features Lightweight and dependency-free Cross-platform sup

vyfor 39 May 6, 2024
Command line tool to convert env variables beginning with user to a htpasswd file

envhtp This command line tool converts environment variables whose keys start with "user_" into htpasswd compatible username/password pairs. The goal

Florian Neumann 1 Apr 5, 2022
Scriptable tool to read and write UEFI variables from EFI shell. View, save, edit and restore hidden UEFI (BIOS) Setup settings faster than with the OEM menu forms.

UEFI Variable Tool (UVT) UEFI Variable Tool (UVT) is a command-line application that runs from the UEFI shell. It can be launched in seconds from any

null 4 Dec 11, 2023
A simple crate, that protects some variables from being modified by memory tampering tools.

Crate: protected_integer A simple crate, that protects some variables from being modified by memory tampering tools. Usage Add this crate to dependenc

lihe 5 Nov 30, 2022
A Yocto setup and management tool that helps you keep your environment up-to-date and in-sync with your team

yb (Yocto Buddy) yb is designed to make it easy to setup and (perhaps more importantly) keep Yocto environments up-to-date and in-sync with your team.

null 13 Oct 31, 2022
Navigate in the world of ESP32 with easy. Tool for maintaining development environment.

ESP Helm Get all important information for Embedded Development with ESP32 and mainitain the development environment. Check out releases for binary ve

Juraj Michálek 4 Aug 7, 2023
An interactive shell environment for exploring the p2panda protocol

An interactive shell environment for exploring the p2panda protocol. Uses a mock node and clients to simulate network logic.

null 4 Dec 12, 2021
Code and Development environment for adventofcode.com - 2021 edition

aoc-2021 Warning Spoiler Alert! If you want to solve the aoc problems on your own, do not read any further. This repository contains solutions for the

docToolchain 11 Oct 22, 2022
Rbenv - Manage your app's Ruby environment

Seamlessly manage your app’s Ruby environment with rbenv. Use rbenv to pick a Ruby version for your application and guarantee that your development en

null 14.7k Jan 7, 2023
By mirroring traffic to and from your machine, mirrord surrounds your local service with a mirror image of its cloud environment.

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

MetalBear 2.1k Jan 3, 2023
Code and Development environment for adventofcode.com - 2022 edition

aoc-2022 Warning Spoiler Alert! If you want to solve the aoc problems on your own, do not read any further. This repository contains solutions for the

docToolchain 8 Dec 26, 2022
Run the right version of python, in the right environment, for your project

rpy Do you deal with lots of virtual python environments? rpy is for you! Before rpy: ~/dev/prj$ env PYTHONPATH=src/py path/to/my/interpreter src/py/m

Aquatic Capital Management 2 Dec 8, 2022
Shared execution environment for constructing 3D virtual spaces from the inside.

Hearth Hearth is a shared, always-on execution environment for constructing 3D virtual spaces from the inside. Come join our Discord server! The Histo

null 6 Jan 31, 2023
The auto-managed -sys crate for Apple platforms using bindgen directly from build environment

apple-sys Apple platforms have a rather monotonous programming environment compared to other platforms. On several development machines, we will depen

Jeong, YunWon 34 Apr 17, 2023
Quickly setup your development environment on your Chromebook/ChromeOS or any Linux distribution 🐧 ❄️ 💻 🚀 ✨

Crosup ?? ?? ?? ✨ Crosup is a CLI tool to help you quickly setup your development environment on a new Chromebook (ChromeOS) or any Linux distribution

Tsiry Sandratraina 11 Jun 15, 2023
⚡️(cd with env) Is a configurable cd wrapper that lets you define your environment per directory.

⚡️cdwe (cd with env) A simple configurable cd wrapper that provides powerful utilities for customizing your envionment per directory. (For ZSH / BASH

teo 20 Aug 6, 2023
Yet another Python environment manager.

yen The easiest Python environment manager. Create virtual environments for any Python version, without needing Python pre-installed. Installation Get

Tushar Sadhwani 19 Oct 7, 2023