working on secrets
This commit is contained in:
38
entrypoint.sh
Normal file
38
entrypoint.sh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
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 "DJANGO_SECRET_KEY"
|
||||
file_env "OIDC_RP_CLIENT_SECRET"
|
||||
file_env "DJANGO_SUPERUSER_PASSWORD"
|
||||
# file_env "MINIO_ROOT_PASSWORD"
|
||||
# file_env "COLLABORATION_SERVER_SECRET"
|
||||
# file_env "POSTGRES_PASSWORD"
|
||||
# file_env "DB_PASSWORD"
|
||||
# file_env "AWS_S3_SECRET_ACCESS_KEY"
|
||||
|
||||
# Execute the actual command (from command: in compose.yml)
|
||||
exec "$@"
|
||||
|
||||
Reference in New Issue
Block a user