This repository has been archived on 2021-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2021-05-17 13:54:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-05-17 14:26:58 +00:00
|
|
|
set -eu
|
2021-05-17 13:54:59 +00:00
|
|
|
|
|
|
|
file_env() {
|
|
|
|
local var="$1"
|
|
|
|
local fileVar="${var}_FILE"
|
|
|
|
local def="${2:-}"
|
|
|
|
|
|
|
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
|
|
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
local val="$def"
|
|
|
|
if [ "${!var:-}" ]; then
|
|
|
|
val="${!var}"
|
|
|
|
elif [ "${!fileVar:-}" ]; then
|
|
|
|
val="$(< "${!fileVar}")"
|
|
|
|
fi
|
|
|
|
export "$var"="$val"
|
|
|
|
unset "$fileVar"
|
|
|
|
}
|
|
|
|
|
|
|
|
file_env "PASSWORD"
|
2021-05-17 14:26:58 +00:00
|
|
|
|
2021-06-28 11:42:02 +00:00
|
|
|
{{ if eq (env "OIDC_ENABLED") "1" }}
|
2021-06-28 12:03:22 +00:00
|
|
|
echo 'auth-openid=1' >> /etc/rstudio/rserver.conf
|
|
|
|
echo 'auth-openid-issuer={{ env "OIDC_ISSUER_URL"}}' >> /etc/rstudio/rserver.conf
|
|
|
|
echo 'auth-openid-base-uri=https://{{ env "DOMAIN" }}' >> /etc/rstudio/rserver.conf
|
2021-06-28 11:42:02 +00:00
|
|
|
{{ end }}
|
|
|
|
|
2021-05-17 14:26:58 +00:00
|
|
|
exec "$@"
|