Fix getting LDM_LOGIN

This commit is contained in:
Martin Lablans 2022-11-03 18:14:11 +01:00
parent 6cd682e42c
commit 62b8cabb31
2 changed files with 5 additions and 6 deletions

View File

@ -65,9 +65,7 @@ case "$ACTION" in
hc_send log "Bridgehead $PROJECT startup: Checking requirements ..."
checkRequirements
hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..."
set -a
setLdmPassword
set +a
export LDM_LOGIN=$(getLdmPassword)
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
;;
stop)

View File

@ -11,10 +11,11 @@ detectCompose() {
fi
}
setLdmPassword() {
getLdmPassword() {
if [ -n "$LDM_PASSWORD" ]; then
log DEBUG "Transforming LDM_PASSWORD into LDM_LOGIN ..."
export LDM_LOGIN=$(docker run --rm -it httpd:alpine htpasswd -nb $PROJECT $LDM_PASSWORD | tr -d '\n' | tr -d '\r')
docker run --rm httpd:alpine htpasswd -nb $PROJECT $LDM_PASSWORD | tr -d '\n' | tr -d '\r'
else
echo -n ""
fi
}