wizetorus
v1.4.0
Published
Project to save, retrieve and populate environment variables using vault server
Downloads
4
Maintainers
Readme
Wizetorus
Project to set, retrieve and populate environment variables using a Vault Server For the moment, this project only works with the version 2 of the KV engine API.
How to use it
Install wizetorus globally
$ npm install -g wizetorus
Inside your project, create a file called .wizetorus.json with the following information:
{ "endpoint": "https://localhost:8200", "engine": "kv2", "project": "org/myProject" "environment": "develop" }
The full path to the secret file inside the vault server will correspond to endpoint/engine/project/<environment>
. The environment attribute is optional and you can define it as a path. If you want to retrieve variables for other environment you can use the -e flag, for example wizetorus view -e devManuel
.
You can use environment variables previously defined inside the .wizetorus file, using the syntax <%= env('ENV_VAR') %>
where ENV_VAR is the name of the variable. For example:
{
"endpoint": "<%= env('VAULT_ENDPOINT') %>",
"engine": "kv2",
"project": "org/myProject"
"environment": "<%= env('STAGE') %>"
}
Login into the VaultServer to return the vaultToken:
$ wizetorus login -m userpass -u username
Copy the client_token attribute returned by the previous command.
Export the following environment variable:
$ export VAULT_TOKEN=client_token
If you do not want to export this variable, you can define it in the .wizetorus file under the vaultToken
attribute.
To set a new environment variable run:
$ wizetorus set key=value
You can also pass a path to a valid json file:
$ wizetorus set ./vars.json
To see the environment variables run:
$ wizetorus view
See all the options for wizetorus:
$wizetorus --help