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 ..." hc_send log "Bridgehead $PROJECT startup: Checking requirements ..."
checkRequirements checkRequirements
hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..." hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..."
set -a export LDM_LOGIN=$(getLdmPassword)
setLdmPassword
set +a
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
;; ;;
stop) stop)

View File

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