add VAULT_ADDR to login shells

pull/81/head
Muhammad Atif Ali 2 years ago
parent 091d36a532
commit c39d60307c
No known key found for this signature in database

@ -43,6 +43,25 @@ vault status
printf "\nStoring token in .vault-token ...\n"
echo "${VAULT_TOKEN}" > ~/.vault-token
# Add VAULT_ADDR to shell login scripts if not already present e.g. .bashrc, .zshrc
# bash
if ! grep -q "VAULT_ADDR" ~/.bashrc; then
printf "\nAdding VAULT_ADDR to ~/.bashrc ...\n"
echo "export VAULT_ADDR=${VAULT_ADDR}" >> ~/.bashrc
fi
# zsh
if ! grep -q "VAULT_ADDR" ~/.zshrc; then
printf "\nAdding VAULT_ADDR to ~/.zshrc ...\n"
echo "export VAULT_ADDR=${VAULT_ADDR}" >> ~/.zshrc
fi
# fish
if ! grep -q "VAULT_ADDR" ~/.config/fish/config.fish; then
printf "\nAdding VAULT_ADDR to ~/.config/fish/config.fish ...\n"
echo "set -x VAULT_ADDR ${VAULT_ADDR}" >> ~/.config/fish/config.fish
fi
# Skip fetching secrets if SECRETS is {}
if [ "${SECRETS}" = "{}" ]; then
exit 0

Loading…
Cancel
Save