2020-02-01 17:34:59 +00:00
|
|
|
#!/usr/bin/env sh
|
2020-02-01 22:14:37 +00:00
|
|
|
|
2021-10-10 13:26:00 +00:00
|
|
|
# shellcheck disable=SC3040
|
2020-02-03 23:24:04 +00:00
|
|
|
set -eo pipefail
|
2020-02-01 17:34:59 +00:00
|
|
|
|
2021-10-10 13:26:00 +00:00
|
|
|
# shellcheck disable=SC1091
|
|
|
|
. /usr/local/lib/log.sh
|
|
|
|
|
2020-12-31 12:22:05 +00:00
|
|
|
/usr/local/bin/gomplate -o /app/.env -f /etc/templates/env.tmpl
|
2020-02-01 17:34:59 +00:00
|
|
|
|
2021-10-10 13:26:00 +00:00
|
|
|
if [ -n "$VAULTWARDEN_DATABASE_URL" ]; then
|
2021-05-15 12:19:58 +00:00
|
|
|
WAITFOR_HOST=$(/usr/local/bin/url-parser host --url "$VAULTWARDEN_DATABASE_URL")
|
|
|
|
WAITFOR_PORT=$(/usr/local/bin/url-parser port --url "$VAULTWARDEN_DATABASE_URL")
|
2020-02-03 22:10:48 +00:00
|
|
|
|
2021-10-10 13:26:00 +00:00
|
|
|
log_info "Wait for database server on '${WAITFOR_HOST}:${WAITFOR_PORT:-5432}'"
|
2020-02-03 22:10:48 +00:00
|
|
|
/usr/local/bin/wait-for "${WAITFOR_HOST}":"${WAITFOR_PORT:-5432}"
|
2020-02-01 17:34:59 +00:00
|
|
|
fi
|
2020-02-01 18:09:53 +00:00
|
|
|
|
2021-10-10 13:26:00 +00:00
|
|
|
log_info "Start Vaultwarden Server\n"
|
2021-05-15 12:19:58 +00:00
|
|
|
exec /app/vaultwarden
|