Dotenv section switcher
Go to file
Dmitriy Pleshevskiy f141e00971
add missed GPL header to each file
2022-08-01 00:10:06 +03:00
src add missed GPL header to each file 2022-08-01 00:10:06 +03:00
test_data add namespaces 2022-07-30 17:31:05 +03:00
.dockerignore add docker and publish the current version to hub 2022-07-31 23:46:43 +03:00
.env.example implement Display and Error traits for our error objects 2022-07-31 00:54:38 +03:00
.envrc add support of nix 2022-07-31 23:24:46 +03:00
.gitignore add namespaces 2022-07-30 17:31:05 +03:00
COPYING . 2022-07-29 16:42:05 +03:00
Cargo.lock add missed GPL header to each file 2022-08-01 00:10:06 +03:00
Cargo.toml bump version 2022-08-01 00:03:34 +03:00
Dockerfile add docker and publish the current version to hub 2022-07-31 23:46:43 +03:00
README.md doc: add many rules to readme 2022-08-01 00:03:07 +03:00
default.nix add support of nix 2022-07-31 23:24:46 +03:00
flake.lock add support of nix 2022-07-31 23:24:46 +03:00
flake.nix add support of nix 2022-07-31 23:24:46 +03:00
shell.nix add support of nix 2022-07-31 23:24:46 +03:00

README.md

vnetod

Dotenv state switcher

You can create many states 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 .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

License

GNU General Public License v3.0 or later

See COPYING to see the full text.