rs-env

Blog: Hierarchical environment variable management

Features

Concept

concept

Installation

bash cargo install rs-env

Usage

The resulting set of environment variables is an amalgamation of all files involved in the dependency tree, parent variables are overwritten by child variables.

Source the resulting set of variables as usual: bash source <(rsenv build <leaf-node.env>)

```bash 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 Edit the FZF selected branch/DAG 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) 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 [possible values: bash, elvish, fish, powershell, zsh] --info
-h, --help Print help -V, --version Print version ```

Basic


Select via FZF


Tree and Branch structure (Smart edit)


Integrations

direnv

direnv activates environments automatically. - rs-env can update the .envrc file with the selected dependency graph variables.

JetBrains Integration

Life injection of environment variables: - Plugin EnvFile can be used to life-inject environment variables. - Use the script runenv.sh as the "EnvFile" script (tick executable checkbox !). - The environment variable RUN_ENV parametrizes which environment to load. - It will look for a file <RUN_ENV>.env in the specified directory.

jetbrain

Development