diff --git a/scripts/deploy-rust-remote.sh b/scripts/deploy-rust-remote.sh index 74f32a77..f68fc78a 100644 --- a/scripts/deploy-rust-remote.sh +++ b/scripts/deploy-rust-remote.sh @@ -485,8 +485,10 @@ WEB_SERVER touch "${TARGET_DIR}/.env" for env_file in "${TARGET_DIR}/.env" "${TARGET_DIR}/.env.local"; do - if [[ -f "${env_file}" ]] && ! grep -q '^GENARRATIVE_SPACETIME_ROOT_DIR=' "${env_file}"; then - printf '\nGENARRATIVE_SPACETIME_ROOT_DIR=${SCRIPT_DIR}/.spacetimedb\n' >>"${env_file}" + if [[ -f "${env_file}" ]]; then + grep -v '^GENARRATIVE_SPACETIME_ROOT_DIR=' "${env_file}" >"${env_file}.tmp" + mv "${env_file}.tmp" "${env_file}" + printf '\nGENARRATIVE_SPACETIME_ROOT_DIR=__GENARRATIVE_RUNTIME_SPACETIME_ROOT_DIR__\n' >>"${env_file}" fi done @@ -582,6 +584,9 @@ load_env_file "${SCRIPT_DIR}/.env" load_env_file "${SCRIPT_DIR}/.env.local" SPACETIME_ROOT_DIR="${GENARRATIVE_SPACETIME_ROOT_DIR:-${SCRIPT_DIR}/.spacetimedb}" +if [[ "${SPACETIME_ROOT_DIR}" == "__GENARRATIVE_RUNTIME_SPACETIME_ROOT_DIR__" ]]; then + SPACETIME_ROOT_DIR="${SCRIPT_DIR}/.spacetimedb" +fi SPACETIME_HOST="${GENARRATIVE_SPACETIME_HOST:-__GENARRATIVE_DEFAULT_SPACETIME_HOST__}" SPACETIME_PORT="${GENARRATIVE_SPACETIME_PORT:-__GENARRATIVE_DEFAULT_SPACETIME_PORT__}" SPACETIME_SERVER_URL="${GENARRATIVE_SPACETIME_SERVER_URL:-http://${SPACETIME_HOST}:${SPACETIME_PORT}}"