From 3390ad995b6cdcab2d2c39cfa3fb5180e266e019 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 4 Feb 2020 10:36:27 +0100 Subject: [PATCH] fix wait-for conditions --- Dockerfile.amd64 | 2 +- .../usr/local/bin/{entrypoint.sh => entrypoint} | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) rename overlay/usr/local/bin/{entrypoint.sh => entrypoint} (69%) diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 index 6d1f6c0..eb48494 100644 --- a/Dockerfile.amd64 +++ b/Dockerfile.amd64 @@ -31,6 +31,6 @@ USER app STOPSIGNAL SIGTERM -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +ENTRYPOINT ["/usr/local/bin/entrypoint"] WORKDIR /app CMD [] diff --git a/overlay/usr/local/bin/entrypoint.sh b/overlay/usr/local/bin/entrypoint similarity index 69% rename from overlay/usr/local/bin/entrypoint.sh rename to overlay/usr/local/bin/entrypoint index c3cf36f..70ed565 100755 --- a/overlay/usr/local/bin/entrypoint.sh +++ b/overlay/usr/local/bin/entrypoint @@ -12,23 +12,24 @@ fi if [ -n "$BITWARDENRS_LDAP_BITWARDEN_URL" ] then - WAITFOR_DB_SCHEME=$(/usr/local/bin/url-parser scheme --url "$BITWARDENRS_LDAP_BITWARDEN_URL") - WAITFOR_DB_HOST=$(/usr/local/bin/url-parser host --url "$BITWARDENRS_LDAP_BITWARDEN_URL") - WAITFOR_DB_PORT=$(/usr/local/bin/url-parser port --url "$BITWARDENRS_LDAP_BITWARDEN_URL") + WAITFOR_BW_SCHEME=$(/usr/local/bin/url-parser scheme --url "$BITWARDENRS_LDAP_BITWARDEN_URL") + WAITFOR_BW_HOST=$(/usr/local/bin/url-parser host --url "$BITWARDENRS_LDAP_BITWARDEN_URL") + WAITFOR_BW_PORT=$(/usr/local/bin/url-parser port --url "$BITWARDENRS_LDAP_BITWARDEN_URL") - if [ -n "$WAITFOR_DB_PORT" ] + if [ -z "$WAITFOR_BW_PORT" ] then - [ "$WAITFOR_DB_SCHEME" = "https" ] && WAITFOR_DB_PORT=433 || WAITFOR_DB_PORT=80 + [ "$WAITFOR_BW_SCHEME" = "https" ] && WAITFOR_BW_PORT=433 || WAITFOR_BW_PORT=80 fi - printf "Wait for bitwarden server on '%s:%s'...\n" "${WAITFOR_DB_HOST}" "${WAITFOR_DB_PORT}" - /usr/local/bin/wait-for "${WAITFOR_DB_HOST}":"${WAITFOR_DB_PORT}" + printf "Wait for bitwarden server on '%s:%s'...\n" "${WAITFOR_BW_HOST}" "${WAITFOR_BW_PORT}" + /usr/local/bin/wait-for "${WAITFOR_BW_HOST}":"${WAITFOR_BW_PORT}" fi if [ -n "$BITWARDENRS_LDAP_HOST" ] then WAITFOR_LDAP_SSL=$(/usr/local/bin/gomplate -i '{{ getenv "BITWARDENRS_LDAP_SSL" "true" | conv.Bool }}') - if [ -n "$WAITFOR_LDAP_PORT" ] + + if [ -z "$WAITFOR_LDAP_PORT" ] then [ "$WAITFOR_LDAP_SSL" = true ] && WAITFOR_LDAP_PORT=636 || WAITFOR_LDAP_PORT=389 fi