mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-24 16:11:08 +02:00
26 lines
716 B
Bash
26 lines
716 B
Bash
#!/usr/bin/env bash
|
|
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
set -e
|
|
|
|
fail() {
|
|
echo "$1" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
[[ -z "$REQPATH" ]] && fail "REQPATH env variable has not been set"
|
|
[[ -z "$VAULT_ADDR" ]] && fail "VAULT_ADDR env variable has not been set"
|
|
[[ -z "$VAULT_INSTALL_DIR" ]] && fail "VAULT_INSTALL_DIR env variable has not been set"
|
|
[[ -z "$VAULT_TOKEN" ]] && fail "VAULT_TOKEN env variable has not been set"
|
|
|
|
binpath="${VAULT_INSTALL_DIR}/vault"
|
|
test -x "$binpath" || fail "unable to locate vault binary at $binpath"
|
|
|
|
export VAULT_FORMAT=json
|
|
if output=$("$binpath" delete "$REQPATH" 2>&1); then
|
|
printf "%s\n" "$output"
|
|
else
|
|
fail "failed to delete path: $REQPATH out=$output"
|
|
fi
|