vaultp

Switch Vault profile easily

Usage no npm install needed!

<script type="module">
  import vaultp from 'https://cdn.skypack.dev/vaultp';
</script>

README

vaultp - VAULT Profile Switcher

Switch Vault profile easily

Preparation

Setup your profile in ~/.vault/config (create folder if not exists)

config example:

{
  "default": {
    "address": "https://vault.example.com",
    "token": "toke1"
  },
  "profile2": {
    "address": "https://vault2.example.com",
    "token": "toekn2"
  }
}

Setup

npm install -g vaultp

Add the following to your .bashrc or .zshrc config

alias vaultp="source _vaultp"

Usage

vaultp

or

vaultp default

Shell prompt

function vault_prompt {
  local profile="${VAULT_PROFILE:=default}"

  echo "%{$fg_bold[blue]%}vault:(%{$fg[yellow]%}${profile}%{$fg_bold[blue]%})%{$reset_color%} "
}
PROMPT='OTHER_PROMPT_STUFF $(vault_prompt)'

Authors

Created by rick lin with inspiration from awsp