wizetorus

1.4.0 • Public • Published

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

  1. Install wizetorus globally

     $ npm install -g wizetorus
    
  2. 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') %>"
    }
  1. Login into the VaultServer to return the vaultToken:

     $ wizetorus login -m userpass -u username
    
  2. Copy the client_token attribute returned by the previous command.

  3. 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.

  1. 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
  1. To see the environment variables run:

     $ wizetorus view
    
  2. See all the options for wizetorus:

     $wizetorus --help
    

Package Sidebar

Install

npm i wizetorus

Weekly Downloads

12

Version

1.4.0

License

UNLICENSED

Unpacked Size

110 kB

Total Files

17

Last publish

Collaborators

  • manuelalcantara