fix wait-for ldap port detection
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Robert Kaussow 2020-02-04 10:22:17 +01:00
parent 49e880431c
commit 9aa5146488
2 changed files with 16 additions and 12 deletions

View File

@ -10,8 +10,12 @@ services:
POSTGRES_PASSWORD: pass
POSTGRES_USER: user
ldap:
container_name: bitwardenrs_ldap
image: osixia/openldap
bitwardenrs:
container_name: bitwardenrs
container_name: bitwardenrs_server
image: xoxys/bitwardenrs:latest
depends_on:
- postgres
@ -24,13 +28,16 @@ services:
BITWARDENRS_ADMIN_TOKEN: my_secure_token
bitwardenrs_ldap:
container_name: bitwardenrs_ldap
container_name: bitwardenrs_ldap_sync
image: xoxys/bitwardenrs_ldap:latest
depends_on:
- bitwardenrs
- ldap
environment:
BITWARDENRS_LDAP_BITWARDEN_URL: http://bitwardenrs:8080
BITWARDENRS_LDAP_BITWARDEN_URL: http://bitwardenrs_server:8080
BITWARDENRS_LDAP_BITWARDEN_ADMIN_TOKEN: my_secure_token
BITWARDENRS_LDAP_HOST: bitwardenrs_ldap
BITWARDENRS_LDAP_PORT: 389
volumes:
data:

View File

@ -6,7 +6,7 @@ set -eo pipefail
if [ -z "$BITWARDENRS_LDAP_BITWARDEN_URL" ] || [ -z "$BITWARDENRS_LDAP_HOST" ]
then
printf "Error: Bitwarden and/or LDAP server not configured. Exiting ..."
printf "Error: Bitwarden and/or LDAP server not configured. Exiting ...\n"
exit 1
fi
@ -16,9 +16,9 @@ then
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")
if [ -n "$WAITFOR_PORT" ]
if [ -n "$WAITFOR_DB_PORT" ]
then
[ "$WAITFOR_DB_SCHEME" = "http" ] && WAITFOR_DB_PORT=80 || WAITFOR_DB_PORT=443
[ "$WAITFOR_DB_SCHEME" = "https" ] && WAITFOR_DB_PORT=433 || WAITFOR_DB_PORT=80
fi
printf "Wait for bitwarden server on '%s:%s'...\n" "${WAITFOR_DB_HOST}" "${WAITFOR_DB_PORT}"
@ -27,13 +27,10 @@ fi
if [ -n "$BITWARDENRS_LDAP_HOST" ]
then
WAITFOR_LDAP_PORT=$(/usr/local/bin/url-parser port --url "$BITWARDENRS_LDAP_BITWARDEN_URL")
if [ "$(/usr/local/bin/gomplate -i '{{ getenv "BITWARDENRS_LDAP_SSL" "true" | conv.Bool }}')" = true ]
WAITFOR_LDAP_SSL=$(/usr/local/bin/gomplate -i '{{ getenv "BITWARDENRS_LDAP_SSL" "true" | conv.Bool }}')
if [ -n "$WAITFOR_LDAP_PORT" ]
then
WAITFOR_LDAP_PORT=636
else
WAITFOR_LDAP_PORT=389
[ "$WAITFOR_LDAP_SSL" = true ] && WAITFOR_LDAP_PORT=636 || WAITFOR_LDAP_PORT=389
fi
printf "Wait for ldap server on '%s:%s'...\n" "${BITWARDENRS_LDAP_HOST}" "${WAITFOR_LDAP_PORT}"