diff --git a/build/entrypoint.sh b/build/entrypoint.sh index 64f4e049..bc0857ae 100755 --- a/build/entrypoint.sh +++ b/build/entrypoint.sh @@ -3,13 +3,13 @@ # If we are using podman or docker compose use the repo config.toml if [[ -f /podman_compose/kai/config.toml ]]; then cp /podman_compose/kai/config.toml /kai/kai/config.toml - sed -i 's/^host\ =.*/host = "kai_db"/g' /kai/kai/config.toml + sed -i "s/^host =.*/host = \"${POSTGRES_HOST}\"/g" /kai/kai/config.toml sed -i "s/^database =.*/database = \"${POSTGRES_DB}\"/g" /kai/kai/config.toml sed -i "s/^user =.*/user = \"${POSTGRES_USER}\"/g" /kai/kai/config.toml sed -i "s/^password =.*/password =\"${POSTGRES_PASSWORD}\"/g" /kai/kai/config.toml fi -until PGPASSWORD="${POSTGRES_PASSWORD}" pg_isready -q -h kai_db -U "${POSTGRES_USER}" -d "${POSTGRES_DB}"; do +until PGPASSWORD="${POSTGRES_PASSWORD}" pg_isready -q -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -d "${POSTGRES_DB}"; do sleep 1 done @@ -19,7 +19,7 @@ if [[ ${MODE} != "importer" ]]; then SQL_EXISTS=$(printf "\dt %s" "${TABLE}") STDERR="Did not find any relation" # trunk-ignore(shellcheck/SC2312) - if PGPASSWORD="${POSTGRES_PASSWORD}" psql -h kai_db -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c "${SQL_EXISTS}" 2>&1 | grep -q -v "${STDERR}"; then + if PGPASSWORD="${POSTGRES_PASSWORD}" psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c "${SQL_EXISTS}" 2>&1 | grep -q -v "${STDERR}"; then echo "################################################" echo "load-data has run already run, starting server.#" echo "################################################" diff --git a/compose.yaml b/compose.yaml index c0f2a9e3..93b3a165 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,6 +13,7 @@ x-db-variables: &db-variables POSTGRES_DB: kai POSTGRES_PASSWORD: dog8code POSTGRES_USER: kai + POSTGRES_HOST: kai_db services: kai: