Skip to content

Commit

Permalink
Don't use subshells for bw commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lablans committed Jul 23, 2024
1 parent 12e1105 commit 2c51dbf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ source ./checkMandVars.sh
bw_login() {
bw config server ${BW_SERVER}
bw login --apikey --raw
export BW_SESSION=$(bw unlock --passwordenv BW_MASTERPASS --raw)
read BW_SESSION < <(bw unlock --passwordenv BW_MASTERPASS --raw)
export BW_SESSION
}

bw_logout(){
Expand All @@ -30,7 +31,7 @@ case "$1" in
RESULT="\n"

while (( "$#" )); do
PASS="$(bw get password $1)"
read PASS < <(bw get password $1)
if [ -z "$PASS" ]; then
echo "ERROR: Password $1 not found in vault. Exiting ..."
exit 1
Expand All @@ -48,7 +49,7 @@ case "$1" in
shift
bw_login
echo "Getting unseal key ..."
UNSEAL_KEY="$(bw get password "Vault Unseal Key")"
read UNSEAL_KEY < <(bw get password "Vault Unseal Key")
echo "Got unseal key."
bw_logout

Expand Down Expand Up @@ -98,4 +99,4 @@ case "$1" in
;;
esac

exit 0
exit 0

0 comments on commit 2c51dbf

Please sign in to comment.