2022-12-07 15:46:19 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function idManagementSetup() {
|
2022-12-07 15:46:19 +01:00
|
|
|
if [ -n "$ENABLE_ID_MANAGEMENT" ]; then
|
2022-12-07 15:46:19 +01:00
|
|
|
log INFO "id-management setup detected -- will start id-management (mainzelliste & magicpl)."
|
|
|
|
OVERRIDE+=" -f ./$PROJECT/modules/id-management-compose.yml"
|
|
|
|
|
|
|
|
# Auto Generate local Passwords
|
2023-01-27 10:59:29 +01:00
|
|
|
PATIENTLIST_POSTGRES_PASSWORD="$(echo \"id-management-module-db-password-salt\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
|
2022-12-07 15:46:19 +01:00
|
|
|
IDMANAGER_LOCAL_PATIENTLIST_APIKEY="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
|
|
|
|
|
2023-01-27 11:52:09 +01:00
|
|
|
# Transform Seeds Configuration to pass it to the Mainzelliste Container
|
|
|
|
PATIENTLIST_SEEDS_TRANSFORMED="$(declare -p PATIENTLIST_SEEDS | tr -d '\"' | sed 's/\[/\[\"/g' | sed 's/\]/\"\]/g')"
|
2022-12-16 12:02:49 +01:00
|
|
|
|
|
|
|
# Ensure old ids are working !!!
|
|
|
|
legacyIdMapping
|
2022-12-07 15:46:19 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
2022-12-16 12:02:49 +01:00
|
|
|
|
|
|
|
# TODO: Map all old site ids to the new ones
|
|
|
|
function legacyIdMapping() {
|
|
|
|
case ${SITE_ID} in
|
|
|
|
"berlin")
|
|
|
|
export IDMANAGEMENT_FRIENDLY_ID=Berlin
|
|
|
|
;;
|
|
|
|
"dresden")
|
|
|
|
export IDMANAGEMENT_FRIENDLY_ID=Dresden
|
|
|
|
;;
|
|
|
|
"frankfurt")
|
|
|
|
export IDMANAGEMENT_FRIENDLY_ID=Frankfurt
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
export IDMANAGEMENT_FRIENDLY_ID=$SITE_ID
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|