#!/bin/sh set -eu umask 077 ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd) runtime_dir=${WNH_RUNTIME_ENV_DIR:-"$ROOT/output/runtime"} target=${WNH_E2E_ENV_FILE:-"$runtime_dir/e2e.env"} mkdir -p "$runtime_dir" chmod 700 "$runtime_dir" if [ -f "$target" ]; then chmod 600 "$target" updated=false if ! grep -q '^TRAEFIK_RETRY_ATTEMPTS=' "$target"; then printf '\nTRAEFIK_RETRY_ATTEMPTS=3\n' >>"$target" updated=true fi if grep -q '^E2E_BASE_URL=http://proxy$' "$target"; then sed -i \ -e 's|^E2E_BASE_URL=http://proxy$|E2E_BASE_URL=https://proxy|' \ -e 's|^PHX_SCHEME=http$|PHX_SCHEME=https|' \ -e 's|^PHX_URL_PORT=80$|PHX_URL_PORT=443|' \ -e 's|^MAP_TILE_URL=http://proxy/|MAP_TILE_URL=https://proxy/|' \ "$target" updated=true fi if grep -Eq '^MAP_TILE_URL=https?://proxy/__e2e__/map-tile\.png' "$target"; then sed -i \ 's|^MAP_TILE_URL=https\?://proxy/__e2e__/map-tile\.png|MAP_TILE_URL=/__e2e__/map-tile.png|' \ "$target" updated=true fi chmod 600 "$target" if [ "$updated" = true ]; then echo "Updated non-secret E2E transport inputs; existing secrets were preserved." else echo "The generated E2E runtime environment already exists; no secret or experiment input was changed." fi exit 0 fi postgres_password=$(openssl rand -hex 32) secret_key_base=$(openssl rand -hex 64) handover_secret=$(openssl rand -hex 64) release_cookie=$(openssl rand -hex 64) metrics_token=$(openssl rand -hex 32) docker_socket_gid=$(stat -c '%g' /var/run/docker.sock) cat >"$target" <