Kvit helps you to sync your key and value pairs between HashiCorp Consul and file system easily. It's developed as an open source CLI app.
Kvit name comes from Consul Key Value + Git like usage = KV + Git = kvit
.NET 7 runtime is a prerequisite. And can be downloaded from here.
Kvit developed as a cross platform console app with .NET 7. You can easily install as a global cli tool.
# Install if not installed, update to the last version if already installed
dotnet tool update -g kvit
This command pulls the latest Kvit binary from NuGet. And add this binary to your path.
After the install, you can easily execute by typing kvit
to your favorite terminal. When you run without a parameter, you can see the basic usage information.
- Use
kvit fetch
and download all keys and values to current folder - Edit this files or add new ones with your favorite text editor
- Optionally use
kvit diff
to see which files are changed - Optionally use
kvit compare <file>
to see which part of your content is different between file system and consul - Then use
kvit push
to upload all to your Consul server
Most kvit commands requires this two parameters:
address
andtoken
- If you omit
address
then tries to connecthttp://localhost:8500
- If you omit
token
then tries to connect without authentication.
Downloads your key/value pairs from your Consul server, and writes all into the current directory.
kvit fetch [--address <address>] [--token <token>]
Uploads your key/value pairs from current directory to your Consul server.
Currently kvit not supports deletion of key value pairs (This feature is in our roadmap)
kvit push [--address <address>] [--token <token>]
Compares keys between Consul and current directory and prints a summary.
- If you add
--all
option, it displays all files in directory, otherwise only display different or missing ones.
kvit diff [--address <address>] [--token <token>] [--all]
Compares the content of key between Consul and file system.
<file>
is a required parameter. You should use the relative path of your current directory. For examplekvit compare folder1/file1
.
kvit compare [--address <address>] [--token <token>] <file>
- .NET 5 SDK
- Docker or a real Consul server (for testing)
Simply run on your IDE or type dotnet run
in src/Kvit
folder.
To run Integration tests, you will need a Consul running on port 8900
. Easiest way to do this, using Docker.
docker run -d --name=consul-for-kvit-testing -p 8900:8500 consul
If you don't have Docker on your system, you can download Consul and run command below
consul agent -dev -http-port=8900
After then, you can simply run tests on your IDE or type dotnet test
in project's root folder.
- A clear README
- Take a backup before the
fetch
andpush
- Add diff support before push to see what's different between local folder and remote Consul server
- Add confirmation messages for commands like "Do you want to continue?"
- Support the deletion of keys and values from Consul when they were deleted from local folder
Free to feel to open issues about your questions and PR thoughts.