Files
spa/.env.example
T
julian 8d0bc2bb1e feat(login): dev-only prefill from VITE_ADMIN_EMAIL/PASSWORD
When import.meta.env.DEV is true, the login form's email and password
fields are populated from the corresponding env vars. Shaves the manual
re-typing during dev iteration.

Production builds get empty strings regardless of build-time env values:
the prefill is gated on import.meta.env.DEV (which Vite replaces with
literal `false` at build time, so the surrounding ternary tree-shakes
and the env values can't bleed into the prod bundle even if accidentally
set in the build env).

Files:
- src/vite-env.d.ts (new): ImportMetaEnv augmentation with the four
  VITE_* vars we use (admin email/password, dev directus/processor URLs).
  Gives proper typing under strict mode.
- src/ui/pages/login.tsx: devDefaults computed once at module scope from
  import.meta.env. Form's defaultValues uses it.
- .env.example: documents VITE_ADMIN_EMAIL and VITE_ADMIN_PASSWORD with
  examples; notes the prod-ignore guarantee.
- .gitignore: adds *.env (defensive — complements the existing *.local
  pattern). .env.example stays committable (doesn't end in .env).
2026-05-02 18:48:04 +02:00

21 lines
1.0 KiB
Bash

# Local dev overrides for vite.config.ts proxy targets.
# Copy to .env.local (gitignored, auto-loaded by Vite) and edit to point
# at your local services. Both have sensible defaults matching the dev
# compose stack — only override when you need to.
# Directus REST + GraphQL + business-plane WebSocket host.
# Defaults to http://localhost:8055 (the dev compose default).
# The WS proxy target is derived by swapping http(s):// for ws(s)://.
VITE_DEV_DIRECTUS_URL=http://localhost:8055
# Processor live-position WebSocket. Defaults to ws://localhost:8081
# (the LIVE_WS_PORT default in the processor's Phase 1.5 task spec).
VITE_DEV_PROCESSOR_WS_URL=ws://localhost:8081
# Local-dev login form prefill. The login page populates these into the
# email/password fields on render when import.meta.env.DEV is true. Skip
# the manual typing during dev iteration. Production builds ignore them
# (the prefill is gated on import.meta.env.DEV).
# VITE_ADMIN_EMAIL=admin@example.com
# VITE_ADMIN_PASSWORD=your-local-admin-password