SkillAgentSearch skills...

Envvars

Give your environment variables the love they deserve.

Install / Use

/learn @flemay/Envvars
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Envvars

Go Reference License Go Report Card GitHub Tag Build Status Build Status<br> Docker Hub Docker Image Version Docker Hub Pulls Badge

<br> <p align="left"><img src="./docs/envvars_gopher.png" width="260"></p>

Give your environment variables the love they deserve.

Overview

Envvars, a command line tool written in Go, provides a way to describe the environment variables of a project and ensures they are defined before testing, building, and deploying. It also generates an env file to be used by other applications such as Docker and Compose.

Installation

# install latest release
$ go install github.com/flemay/envvars@latest

# install from source
$ git clone https://github.com/flemay/envvars
$ cd envvars
$ go install ./...

# or use the tiny docker image (< 5 MB)
# example for version 0.0.8
$ docker run --rm flemay/envvars:0.0.8 --help

Usage

# create a declaration file envvars.yml
# envvars:
#   - name: ECHO
#     example: Hello World
$ envvars init

# validate the declaration file if it contains errors
$ envvars validate

# ensure the environment variables comply with the declaration file. The declaration file is also validated.
$ envvars ensure
# Error: environment variable ECHO is not defined
# set ECHO with empty value
$ export ECHO=""
$ envvars ensure
# Error: environment variable ECHO is empty
# set ECHO with non-empty value
$ export ECHO="helloworld"
$ envvars ensure

# create an env file
$ envvars envfile
$ cat .env
# ECHO

# create an env file with the example value
$ envvars envfile -overwrite -example
$ cat .env
# ECHO=Hello World

# explore
$ envvars --help

Declaration File

The declaration file (written in YAML) is the core of Envvars. It declares all the environment variables used by a project.

Envvars is looking for the declaration file envvars.yml by default. A different file can be passed with the flag -f path/to/declarationfile.yml.

tags:
  - name: deploy
    desc: tag used when deploying

envvars:
  - name: ENV
    desc: Application stage (dev, qa, preprod, prod)
    tags:
      - deploy
    optional: true
    example: dev

| Field | Type | Required | Description | |------------------|:--------------:|:--------:|------------------------------------------------------------------------------------------------------------------------------------| | tags | list | no | List of tags to be used for targeting a subset of environment variables | | tags.name | string | yes | Unique tag name | | tags.desc | string | no | Meaningful description of the tag | | envvars | list | yes | List of environment variables | | envvars.name | string | yes | Unique environment variable name | | envvars.desc | string | no | Meaningful description of the environment variable | | envvars.tags | list of string | no | List of tags for the environment variable. Each tag must be declared in the "tags" field. | | envvars.optional | bool | no | Allows the environment variable to be empty or not defined. It is best to avoid it unless your application accepts an empty value. | | envvars.example | string | no | Example value for the environment variable. |

Guidelines

Documentation is your best friend

The field desc should be used if the name of the tag or environment variable is not self-explanatory. This helps anyone new to the project, or juggling with many projects at once, to understand every environment variable, and tag.

The 3 Musketeers

Envvars fits nicely with the 3 Musketeers for managing the environment variables used by an application.

Contributing

Contributions are greatly appreciated. Everyone can contribute and here are different ways.

Releases and current state

Envvars is in its early stage and its API is not stable. Envvars will be production ready when it reaches v1.0.0.

See Automation & Configuration for more details.

Stargazers over time

Stargazers over time

License

MIT

Related Skills

View on GitHub
GitHub Stars21
CategoryDevelopment
Updated10mo ago
Forks6

Languages

Go

Security Score

87/100

Audited on May 16, 2025

No findings