#env #dotenv #change #switcher

app vnetod

Are you still switching sections in your dotenv file manually? Try this dotenv section switcher

7 releases

Uses new Rust 2021

0.3.2 Aug 2, 2022
0.3.1 Aug 2, 2022
0.2.2 Jul 31, 2022
0.1.0 Jul 29, 2022

#42 in Configuration

Download history 23/week @ 2022-07-24 178/week @ 2022-07-31 34/week @ 2022-08-07

235 downloads per month

GPL-3.0+

22KB
372 lines

vnetod*

* inverted word "dotenv"

Are you still switching sections in your dotenv file manually? Try this dotenv section switcher!

You can create many sections in your .env and switch between them.

Rules:

  • State name starts on a new line with ### symbols (Ex. ### local)
  • State name can contain multiple comma-separated sections (Ex. ### local,staging)
  • Each section may specify a namespace (Ex. ### debug:on,dev:on). If a section doesn't contain a namespace, it's a global namespace.
  • State ends if line is empty or contains a new state name.

You can see the full example.

Usage

Basic usage

cp .env.example .env
vnetod local        # enable local section
vnetod staging      # enable staging section
vnetod local debug  # enable local and debug sections
vnetod              # disable all sections

This tool uses .env from your current location, but you can change this behavior with the -f (--file) flag.

cp .env.example .env.properties
vnetod -f .env.properties local

And you can also change the output file with the -o (--output) flag, if you don't want to overwrite the input file.

vnetod -f .env.example -o .env local

You can also use variables from namespaces

vnetod db:staging debug:off

You can switch between states and overwrite from namespaces at the same time.

vnetod local db:staging debug:off

For more information, see the help.

vnetod --help

Install

Cargo

cargo install vnetod

Docker

docker run --rm -it -v $PWD:/data pleshevskiy/vnetod --help

Nix

nix run git+https://git.pleshevski.ru/pleshevskiy/vnetod -- --help

Contact me

License

GNU General Public License v3.0 or later

See COPYING to see the full text.

Dependencies

~2–2.7MB
~49K SLoC