-
Notifications
You must be signed in to change notification settings - Fork 0
/
vlt.sh
executable file
·36 lines (28 loc) · 1.03 KB
/
vlt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
if [ ! -f "./.env" ]; then
echo "Please make sure .env file exists and it has a PROXY_ALIAS"
exit 1
fi
CURRFOLDER=`pwd`
PROXY_FOLDER=`basename $CURRFOLDER`
echo "Proxy Folder: $PROXY_FOLDER"
PROXY_ALIAS=`cat .env | grep PROXY_ALIAS | sed -e 's/PROXY_ALIAS=//g'`
echo "Proxy Alias: $PROXY_ALIAS"
if [ x"$PROXY_ALIAS" = "x" ]; then
echo "Please make sure .env file exists and it has a PROXY_ALIAS"
exit 1
fi
PROXY_NAME=${PROXY_ALIAS}
echo "Proxy Name: $PROXY_NAME"
CONTAINER_ID=$(docker ps | grep cmd-exec | grep ${PROXY_NAME} | awk '{print $1}')
if [ x"$CONTAINER_ID" = "x" ]; then
echo "Container not found for ${PROXY_NAME}. Checking parent folder $PROXY_FOLDER"
CONTAINER_ID=$(docker ps | grep cmd-exec | grep ${PROXY_FOLDER} | awk '{print $1}')
fi
echo "Connecting to container: ${CONTAINER_ID}"
if [ x"$CONTAINER_ID" = "x" ]; then
echo "Container ID is empty"
exit 1
fi
CMD="docker exec -it ${CONTAINER_ID} dkvault --vault-url=https://vault:8200 --vault-unseal-tokens-file ./src/keys/vault_unseal.keys $*"
eval $CMD