Implement "list" command
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
b5a1d5dc90
commit
801f0ff65c
1 changed files with 11 additions and 0 deletions
|
@ -49,6 +49,16 @@ function hash_hostname() {
|
|||
echo "$1" | md5sum | cut -d ' ' -f 1
|
||||
}
|
||||
|
||||
function list() {
|
||||
local creds="{}"
|
||||
|
||||
for key in $(vault list -format=json secret/docker-credential | jq -r '.[]'); do
|
||||
creds="$(vault read -field=data -format=json "${PREFIX}/${key}" | jq -c "${creds} + {(.ServerURL): .Username}")"
|
||||
done
|
||||
|
||||
echo "${creds}"
|
||||
}
|
||||
|
||||
function log() {
|
||||
[ $NO_LOG -eq 0 ] || return 0
|
||||
echo "[$(date +%H:%M:%S)][docker-credential-vault] $@" >&2
|
||||
|
@ -62,6 +72,7 @@ function main() {
|
|||
case "${1:-}" in
|
||||
get) get ;;
|
||||
erase) erase ;;
|
||||
list) list ;;
|
||||
store) store ;;
|
||||
*)
|
||||
echo "$(basename $0): Supported are only: get, erase, store (called '${1:-}')" >&2
|
||||
|
|
Loading…
Reference in a new issue