Home

Awesome

rs-env

Hierarchical environment variable management

Why

Managing environment variables for different projects, stages, regsions, etc. is an unavoidable chore when working on many cloud projects.

Especially the challenge of avoiding duplication and knowing where a particular value is coming from. Hierarchical variable management seems to be a good solution for this problem.

Features

Concept

concept

Installation

cargo install rs-env

Usage

The resulting set of environment variables is an amalgamation of all linked files.

Then source the resulting set of variables as usual:

source <(rsenv build <leaf-node.env>)
Hierarchical environment variable management

Usage: rsenv [OPTIONS] [NAME] [COMMAND]

Commands:
  build        Build the resulting set of environment variables (DAG/Tree)
  envrc        Write the resulting set of variables to .envrc (requires direnv, DAG/Tree)
  files        Show all files involved in resulting set (DAG/Tree)
  edit-leaf    Edit the given environment file and all its parents (DAG/Tree)
  edit         Edit the FZF selected branch/DAG
  select-leaf  select environment/branch and update .envrc file (requires direnv, DAG/Tree)
  select       FZF based selection of environment/branch and update of .envrc file (requires direnv, DAG/Tree)
  link         Link files into a linear dependency branch (root -> parent -> child)
  branches     Show all branches (linear representation)
  tree         Show all trees (hierarchical representation)
  tree-edit    Edit branches of all trees side-by-side (vim required in path)
  leaves       Output leaves as paths (Tree)
  help         Print this message or the help of the given subcommand(s)

Arguments:
  [NAME]  Optional name to operate on

Options:
  -d, --debug...              Turn debugging information on
      --generate <GENERATOR>  [possible values: bash, elvish, fish, powershell, zsh]
      --info                  
  -h, --help                  Print help
  -V, --version               Print version

Basic

<a href="https://asciinema.org/a/605946?autoplay=1&speed=1.5" target="_blank"><img src="https://asciinema.org/a/605946.svg" /></a> <br>

Select via FZF

<a href="https://asciinema.org/a/605951?autoplay=1&speed=1.5" target="_blank"><img src="https://asciinema.org/a/605951.svg" /></a> <br>

Tree and Branch structure (Smart edit)

<a href="https://asciinema.org/a/605950?autoplay=1&speed=1.5" target="_blank"><img src="https://asciinema.org/a/605950.svg" /></a> <br>

Integrations

direnv

direnv activates environments automatically.

JetBrains Integration

Life injection of environment variables:

jetbrain

Development