Commit Graph

4 Commits

Author SHA1 Message Date
gnezim 99562c2218 Proxy Aeroflot shell in standalone 2026-05-21 11:05:04 +03:00
gnezim d43bfb3fcb Fix URL truncation from bash \${VAR:=default} with braces
CI / ci (push) Failing after 31s
Deploy / build-and-deploy (push) Failing after 5s
Deployed build had MAP_TILE_URL truncated to 'https://.../tile/{z' —
Leaflet then URL-encoded it to '%7Bz' and fetched garbage tile paths.
Root cause: build-docker.sh used

    : "\${MAP_TILE_URL:=https://flights.test.aeroflot.ru/map/api/tile/{z}/{x}/{y}.jpeg}"

and bash parameter expansion terminates the default value at the
FIRST unescaped '}', leaving '{z' and discarding the rest. The env
passed to `pnpm build:standalone` was already truncated, so every
downstream step (base64 encode → HTML inject → client decode) faithfully
carried the broken value through.

Fix by moving the defaults to Dockerfile's ARG lines — ARG defaults
are plain strings, not shell-parsed — and simplify build-docker.sh to
only forward MAP_TILE_URL / API_BASE_URL as --build-arg when the
caller explicitly sets them. Quote the k8s env values for defensive
YAML hygiene as well.
2026-04-19 00:44:45 +03:00
gnezim 2e2c5c09ce Fix __ENV__ truncation; route API_BASE_URL through the same injection
CI / ci (push) Failing after 30s
Deploy / build-and-deploy (push) Failing after 6s
Two gaps blocked http://flights-ui.devwebzavod.ru/ru/flights-map:

1. The inline <script>window.__ENV__=...</script> was written with the
   Leaflet tile template ('/map/api/tile/{z}/{x}/{y}.jpeg') embedded
   directly. Rspack's html-plugin pre-processes the children string and
   ate the '{z}' placeholder, truncating the injected JS literal to
   '/map/api/tile/{z' — MAP_TILE_URL on the client ended up broken and
   getEnv() fell back to the default.

   Escape every '{'/'}' inside the stringified value as '\u007B'/'\u007D'.
   JS decodes the Unicode escapes back to '{}' at parse time; the html
   plugin's template engine sees no placeholders to eat. Object-literal
   braces outside the string stay raw (Unicode escapes aren't valid in
   operator positions in JS source).

2. API_BASE_URL was still hard-defaulting to 'http://localhost:8080/api',
   so every dictionary fetch on the deployed cluster died with
   ERR_CONNECTION_REFUSED. Thread API_BASE_URL through the same
   PUBLIC_ENV_KEYS/html.tags path as MAP_TILE_URL, add matching Docker
   ARG/ENV, and forward it in deployment/build-docker.sh + k8s manifest.

The devwebzavod default for both is https://flights.test.aeroflot.ru
— where the real Aeroflot ingress terminates /map/api/** and /api/**.
Prod keeps overriding with same-origin URLs.
2026-04-18 23:56:28 +03:00
gnezim 496a72e7d7 Track k8s manifest; teach make sync to mirror deployment/
CI / ci (push) Failing after 32s
Deploy / build-and-deploy (push) Failing after 5s
The flights-front deploy repo ships k8s manifests at deployment/k8s/,
a sibling of Aeroflot.Flights.Front/. Previously the sync script only
copied the app source, so any env change landed on the k8s side had
to be hand-edited in the deploy repo and was never reflected back.

- Bring deployment/k8s/flights-ui.yaml into this repo (with the new
  MAP_TILE_URL env pointing at flights.test.aeroflot.ru) so the
  cluster config lives next to the code that reads it.
- sync-to-flights-front.sh resolves the deploy-repo root from the
  target path and mirrors this repo's deployment/ directory there,
  mkdir'ing and copying contents without wiping unrelated files.
- Bump step numbering (1/6..6/6) and the summary now lists the synced
  deployment files in addition to the app files.
2026-04-18 22:51:26 +03:00