#!/bin/sh # Check if the required variables are set if [ -z "${KOMPASS_DB_HOST}" ]; then echo "Error: KOMPASS_DB_HOST is not set. Exiting." exit 1 fi # Replace placeholders with environment variables in the SQL file if [ -f /docker-entrypoint-initdb.d/create_users.sql ]; then sed -i "s/KOMPASS_DB_PASSWORD/${KOMPASS_DB_PASSWORD}/g" /docker-entrypoint-initdb.d/create_users.sql sed -i "s/KOMPASS_DB_PAM_PASSWORD/${KOMPASS_DB_PAM_PASSWORD}/g" /docker-entrypoint-initdb.d/create_users.sql sed -i "s/KOMPASS_DB_QUERYMAIL_PASSWORD/${KOMPASS_DB_QUERYMAIL_PASSWORD}/g" /docker-entrypoint-initdb.d/create_users.sql sed -i "s/KOMPASS_DB_HOST/${KOMPASS_DB_HOST}/g" /docker-entrypoint-initdb.d/create_users.sql fi echo "Update create_users.sql."