castellan/tools/setup-vault-env.sh
Moises Guimaraes de Medeiros 8f112b9afb Bump HashiCorp Vault version for tests.
Change-Id: I7de2f338c1c524a9824e73d3921dd304bdcf764d
Signed-off-by: Moises Guimaraes de Medeiros <moguimar@redhat.com>
2018-08-22 16:07:28 +02:00

32 lines
853 B
Bash
Executable File

#!/bin/bash
set -eux
if [ -z "$(which vault)" ]; then
VAULT_VERSION=0.10.4
SUFFIX=zip
case `uname -s` in
Darwin)
OS=darwin
;;
Linux)
OS=linux
;;
*)
echo "Unsupported OS"
exit 1
esac
case `uname -m` in
x86_64)
MACHINE=amd64
;;
*)
echo "Unsupported machine"
exit 1
esac
TARBALL_NAME=vault_${VAULT_VERSION}_${OS}_${MACHINE}
test ! -d "$TARBALL_NAME" && mkdir ${TARBALL_NAME} && wget https://releases.hashicorp.com/vault/${VAULT_VERSION}/${TARBALL_NAME}.${SUFFIX} && unzip -d ${TARBALL_NAME} ${TARBALL_NAME}.${SUFFIX} && rm ${TARBALL_NAME}.${SUFFIX}
export VAULT_CONFIG_PATH=$(pwd)/$TARBALL_NAME/vault.json
export PATH=$PATH:$(pwd)/$TARBALL_NAME
fi
$*