Created
June 19, 2019 12:15
-
-
Save rcbop/8cdccf533df6b30473cdd1d10ce8aa33 to your computer and use it in GitHub Desktop.
vault tree walk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function walk() { | |
for secret in $(vault list $1 | tail -n +3) | |
do | |
if [[ ${secret} == *"/" ]] ; then | |
walk "${1}${secret}" | |
else | |
echo "${1}${secret}" | |
fi | |
done | |
} | |
query="${1}" | |
if [[ ${query} != *"/" ]] ; then | |
query=${query}/ | |
fi | |
echo "${1}" | |
walk ${query} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment