Git Product home page Git Product logo

checkenv's Introduction

checkenv

Don't get surprised by your environment variables.

Rationale

At Bugout, we configure our applications using environment variables. This follows the Twelve Factor App methodology and generally serves us well.

Still, there are many ways to pass environment variables to an application process. For example, we store environment variables on AWS Systems Manager Parameter Store and on Google Cloud Secret Manager. When we deploy applications to our servers, the first step is to download these environment variables from the cloud store and write them to environment files. We then pass these environment files to the systemd services responsible for running the applications using the EnvironmentFile parameter.

In our development environments, we have files that are very similar to the systemd environment files, except they explicitly export the environment variables. We source these environment files before we run the development versions of our applications.

It can sometimes be difficult to understand:

  1. Whether all the environment variables we expect to be defined in production actually have been.
  2. What the particular value of a production environment actually is.
  3. What the differences are between our expectations and the actual environment variables in a running application process.

We are building and maintaining checkenv to make it easier for us to diagnose and fix issues with application configuration via environment variables. We stand in solidarity with anyone else who experiences these kinds of issues. We are doing this for you, too! :)

Architecture

Because environment variables can come from different providers - an active shell, an environment file, a cloud configuration store - checkenv allows environment providers to be registered at build time using build tags.

This means that you can write a custom environment provider for checkenv and build a custom checkenv binary which supports your needs.

There is currently no need to support runtime plugins. Since doing so would make this program a lot more complicated, we have decided to forego runtime plugin functionality for now.

Usage

./checkenv plugins

Available plugins:

  • env - Provides the environment variables defined in the checkenv process.
  • file - Provides the environment variables defined in the env file with the given path.
  • proc - Provides the environment variables set for the process with the given pid.
  • aws_ssm - Provides environment variables defined in AWS Systems Manager Parameter Store.

aws_ssm plugin

In order to fetch parameters with tags Product = test and Node = true with export prefix execute following command

./checkenv show -export aws_ssm+Product:test,Node:true

checkenv's People

Contributors

kompotkot avatar zomglings avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.