feat: add container library #38
@ -1,40 +1,39 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# shellcheck disable=SC3040
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
. /usr/local/lib/log.sh
|
||||||
|
|
||||||
/usr/local/bin/gomplate -o /app/config.toml -f /etc/templates/config.toml.tmpl
|
/usr/local/bin/gomplate -o /app/config.toml -f /etc/templates/config.toml.tmpl
|
||||||
|
|
||||||
if [ -z "$VAULTWARDEN_LDAP_VAULTWARDEN_URL" ] || [ -z "$VAULTWARDEN_LDAP_HOST" ]
|
if [ -z "$VAULTWARDEN_LDAP_VAULTWARDEN_URL" ] || [ -z "$VAULTWARDEN_LDAP_HOST" ]; then
|
||||||
then
|
log_error "Error: Vaultwarden and/or LDAP server not configured, exiting"
|
||||||
printf "Error: Vaultwarden and/or LDAP server not configured. Exiting ...\n"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$VAULTWARDEN_LDAP_VAULTWARDEN_URL" ]
|
if [ -n "$VAULTWARDEN_LDAP_VAULTWARDEN_URL" ]; then
|
||||||
then
|
|
||||||
WAITFOR_BW_SCHEME=$(/usr/local/bin/url-parser scheme --url "$VAULTWARDEN_LDAP_VAULTWARDEN_URL")
|
WAITFOR_BW_SCHEME=$(/usr/local/bin/url-parser scheme --url "$VAULTWARDEN_LDAP_VAULTWARDEN_URL")
|
||||||
WAITFOR_BW_HOST=$(/usr/local/bin/url-parser host --url "$VAULTWARDEN_LDAP_VAULTWARDEN_URL")
|
WAITFOR_BW_HOST=$(/usr/local/bin/url-parser host --url "$VAULTWARDEN_LDAP_VAULTWARDEN_URL")
|
||||||
WAITFOR_BW_PORT=$(/usr/local/bin/url-parser port --url "$VAULTWARDEN_LDAP_VAULTWARDEN_URL")
|
WAITFOR_BW_PORT=$(/usr/local/bin/url-parser port --url "$VAULTWARDEN_LDAP_VAULTWARDEN_URL")
|
||||||
|
|
||||||
if [ -z "$WAITFOR_BW_PORT" ]
|
if [ -z "$WAITFOR_BW_PORT" ]; then
|
||||||
then
|
|
||||||
[ "$WAITFOR_BW_SCHEME" = "https" ] && WAITFOR_BW_PORT=433 || WAITFOR_BW_PORT=80
|
[ "$WAITFOR_BW_SCHEME" = "https" ] && WAITFOR_BW_PORT=433 || WAITFOR_BW_PORT=80
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Wait for vaultwarden server on '%s:%s'...\n" "${WAITFOR_BW_HOST}" "${WAITFOR_BW_PORT}"
|
log_info "Wait for Vaultwarden server on '${WAITFOR_BW_HOST}:${WAITFOR_BW_PORT}'"
|
||||||
/usr/local/bin/wait-for "${WAITFOR_BW_HOST}":"${WAITFOR_BW_PORT}"
|
/usr/local/bin/wait-for "${WAITFOR_BW_HOST}":"${WAITFOR_BW_PORT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$VAULTWARDEN_LDAP_HOST" ]
|
if [ -n "$VAULTWARDEN_LDAP_HOST" ]; then
|
||||||
then
|
|
||||||
WAITFOR_LDAP_SSL=$(/usr/local/bin/gomplate -i '{{ getenv "VAULTWARDEN_LDAP_SSL" "true" | conv.Bool }}')
|
WAITFOR_LDAP_SSL=$(/usr/local/bin/gomplate -i '{{ getenv "VAULTWARDEN_LDAP_SSL" "true" | conv.Bool }}')
|
||||||
|
|
||||||
if [ -z "$VAULTWARDEN_LDAP_PORT" ]
|
if [ -z "$VAULTWARDEN_LDAP_PORT" ]; then
|
||||||
then
|
|
||||||
[ "$WAITFOR_LDAP_SSL" = true ] && VAULTWARDEN_LDAP_PORT=636 || VAULTWARDEN_LDAP_PORT=389
|
[ "$WAITFOR_LDAP_SSL" = true ] && VAULTWARDEN_LDAP_PORT=636 || VAULTWARDEN_LDAP_PORT=389
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Wait for ldap server on '%s:%s'...\n" "${VAULTWARDEN_LDAP_HOST}" "${VAULTWARDEN_LDAP_PORT}"
|
log_info "Wait for LDAP server on '${VAULTWARDEN_LDAP_HOST}:${VAULTWARDEN_LDAP_PORT}'"
|
||||||
/usr/local/bin/wait-for "${VAULTWARDEN_LDAP_HOST}":"${VAULTWARDEN_LDAP_PORT}"
|
/usr/local/bin/wait-for "${VAULTWARDEN_LDAP_HOST}":"${VAULTWARDEN_LDAP_PORT}"
|
||||||
|
|
||||||
# TODO: add delay to minimize connection errors
|
# TODO: add delay to minimize connection errors
|
||||||
|
Reference in New Issue
Block a user