40 lines
1.4 KiB
Bash
40 lines
1.4 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
set -e
|
||
|
|
set -a # export everything in the config for later use by envsubst
|
||
|
|
|
||
|
|
. $1 # source the apps.config file with then env vars
|
||
|
|
|
||
|
|
read -r -a APP_CONFIGS <<< "$APP_CONFIGS"
|
||
|
|
|
||
|
|
nassella_subdomain=
|
||
|
|
|
||
|
|
for config_string in ${APP_CONFIGS[@]}; do
|
||
|
|
IFS=','
|
||
|
|
read -r -a config <<< "$config_string"
|
||
|
|
|
||
|
|
app=${config[0]}
|
||
|
|
subdomain=${config[1]}
|
||
|
|
|
||
|
|
if [ "$app" = "nassella" ]; then
|
||
|
|
nassella_subdomain="$subdomain"
|
||
|
|
fi
|
||
|
|
done
|
||
|
|
|
||
|
|
export NASSELLA_FULL_DOMAIN="$nassella_subdomain.$ROOT_DOMAIN"
|
||
|
|
export NASSELLA_FULL_LLDAP_DOMAIN="$NASSELLA_LLDAP_SUBDOMAIN.$nassella_subdomain.$ROOT_DOMAIN"
|
||
|
|
envsubst < all-apps/nassella/lldap-config/lldap_config.toml.tmpl > all-apps/nassella/lldap-config/lldap_config.toml
|
||
|
|
|
||
|
|
# write secrets
|
||
|
|
echo "$NASSELLA_POSTGRES_DB" > all-apps/nassella/postgres_db
|
||
|
|
echo "$NASSELLA_POSTGRES_USER" > all-apps/nassella/postgres_user
|
||
|
|
echo "$NASSELLA_POSTGRES_PASSWORD" > all-apps/nassella/postgres_password
|
||
|
|
|
||
|
|
echo "$NASSELLA_AUTHELIA_POSTGRES_DB" > all-apps/nassella/authelia_postgres_db
|
||
|
|
echo "$NASSELLA_AUTHELIA_POSTGRES_USER" > all-apps/nassella/authelia_postgres_user
|
||
|
|
echo "$NASSELLA_AUTHELIA_POSTGRES_PASSWORD" > all-apps/nassella/authelia_postgres_password
|
||
|
|
|
||
|
|
echo "$NASSELLA_LLDAP_POSTGRES_DB" > all-apps/nassella/lldap_postgres_db
|
||
|
|
echo "$NASSELLA_LLDAP_POSTGRES_USER" > all-apps/nassella/lldap_postgres_user
|
||
|
|
echo "$NASSELLA_LLDAP_POSTGRES_PASSWORD" > all-apps/nassella/lldap_postgres_password
|