-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclowder_init.sh
More file actions
executable file
·31 lines (25 loc) · 903 Bytes
/
clowder_init.sh
File metadata and controls
executable file
·31 lines (25 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
env_file="/tmp/clowder_envs.sh"
if [[ -z "${ACG_CONFIG}" ]]; then
export PG_BOUNCER_LISTEN_PORT="5432"
elif [[ ! -f "${env_file}" ]]; then
python3 /json_to_env.py --prefix "CLOWDER_" "${ACG_CONFIG}" > "${env_file}"
fi
if [[ -f "${env_file}" && -n "${ACG_CONFIG}" ]]; then
source "${env_file}"
export DB_NAME="${CLOWDER_DATABASE_NAME}"
export DB_HOST="${CLOWDER_DATABASE_HOSTNAME}"
export DB_PORT="${CLOWDER_DATABASE_PORT}"
export DB_USER="${CLOWDER_DATABASE_USERNAME}"
export DB_PASSWORD="${CLOWDER_DATABASE_PASSWORD}"
export DB_SSLMODE="${CLOWDER_DATABASE_SSLMODE}"
export DB_CAFILE="/etc/pgbouncer/rdsca.cert"
export PG_BOUNCER_LISTEN_PORT="${CLOWDER_WEBPORT}"
db_cert="${CLOWDER_DATABASE_RDSCA}"
>${DB_CAFILE}
if [[ -n "${db_cert}" ]]; then
echo "${db_cert}" > ${DB_CAFILE}
unset db_cert
fi
[[ -z "${DB_PORT}" ]] && DB_PORT="5432"
fi