Commit 434f1a2e authored by Aryan Noshirvnai's avatar Aryan Noshirvnai

Stop gitignoring env config that holds no secrets - commit .env/.env.development/.env.production

.env, .env.development(.local), and .env.production(.local) have held zero
actual secrets since the dev auto-login token pair was removed earlier
today - just a backend URL and a proxy target, neither sensitive (the
backend URL is already visible in the compiled JS bundle regardless).
Gitignoring them anyway meant a fresh checkout had no working config at
all, and specifically meant .env.development.local/.env.production.local
(the overrides that route API calls through vite's same-origin proxy
instead of an absolute http:// URL, avoiding mixed-content blocking) could
silently go missing with zero server-side signal - exactly the failure
mode that caused two separate "nothing works" incidents today.

Renamed the two .local overrides to .env.development/.env.production
(Vite's convention for committed, mode-specific config, as opposed to
.local's convention for gitignored personal overrides) and committed all
three files for real. *.local stays gitignored for genuine personal
overrides (e.g. .env.local) going forward. .env.example now documents that
the real values are already committed, not something to copy by hand.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
parent a631b91b
Pipeline #1090 canceled with stage
# Base default for VITE_API_BASE_URL, all Vite modes. Both .env.development and .env.production
# (committed alongside this file - see the .gitignore comment) override this with the relative
# `/api` proxy path instead, since this box serves both dev and the "production" build through
# vite's own same-origin proxy rather than exposing the backend directly over https - see
# BACKEND_PROXY_TARGET below and stax_dev_mode_is_the_real_slowness in project memory. This
# absolute URL only actually takes effect if this app is ever built and served a different way
# (a real reverse proxy/CDN in front, backend on HTTPS) - don't delete it thinking it's dead,
# it's the fallback for that scenario.
VITE_API_BASE_URL=http://144.76.210.145:8000
# Loopback, not the public IP: vite and the backend run on the same host, so this hop should
# never leave the machine. Pointing it at the public IP used to "work" only by accident, via
# Hetzner NAT-hairpinning a self-connection back through the same firewall path that already
# caused an outage in this project once - every API call paid for a real cloud-network round
# trip for what's actually a loopback-local call. See vite.config.ts.
BACKEND_PROXY_TARGET=http://127.0.0.1:8000
# There used to be a VITE_DEV_ACCESS_TOKEN/VITE_DEV_REFRESH_TOKEN pair here for auto-login in
# dev mode - removed 2026-08-15. It was a single-use, rotating refresh token baked into this
# static file and shared across every consumer (every dev session, every test run, every
# curl); the instant any one of them used it, the backend rotated it and this file's copy went
# dead for everyone else, with no way to keep a static file in sync with a rotating secret.
# That's what "the site is slow/broken" turned out to be, repeatedly. Just log in for real
# instead - real username/password login is just as fast and has no such failure mode. (Local
# dev-only test account credentials live outside version control - do not put them in a
# committed file, this one included.)
# Committed (not gitignored - see the .gitignore comment for why): route API calls through
# the vite dev server's own same-origin proxy (see vite.config.ts) instead of hitting the
# backend directly, which the browser blocks as mixed content once the dev server itself is
# https://. This value is specific to `npm run dev` (Vite's "development" mode) - see
# .env.production for the equivalent override for `vite build`/`vite preview`, and plain .env
# for the base default plus BACKEND_PROXY_TARGET (not mode-specific).
VITE_API_BASE_URL=/api
# This is a reference template, not something you need to copy - .env, .env.development, and
# .env.production are all already committed in this repo with real, working values (see the
# .gitignore comment: none of it has been a secret since the dev auto-login token pair was
# removed 2026-08-15). A fresh checkout works with zero setup. Use this file only if setting up
# a genuinely different deployment (a different box, a different proxy topology) where those
# committed values don't apply - copy what you need into a new .env.local (gitignored, for a
# personal override) rather than editing the committed files for a one-off.
# Base URL of the stax_backend_api instance to talk to. Point this at the dev server while # Base URL of the stax_backend_api instance to talk to. Point this at the dev server while
# developing, and at prod for a production build. # developing, and at prod for a production build.
VITE_API_BASE_URL=http://144.76.210.145:8000 VITE_API_BASE_URL=http://144.76.210.145:8000
...@@ -10,28 +18,23 @@ BACKEND_PROXY_TARGET=http://127.0.0.1:8000 ...@@ -10,28 +18,23 @@ BACKEND_PROXY_TARGET=http://127.0.0.1:8000
# `npm run dev` runs over https:// (see the basicSsl comment in vite.config.ts), so calling the # `npm run dev` runs over https:// (see the basicSsl comment in vite.config.ts), so calling the
# still-http:// backend directly gets blocked as mixed content - route it through the dev # still-http:// backend directly gets blocked as mixed content - route it through the dev
# server's own same-origin proxy instead by creating .env.development.local (gitignored via # server's own same-origin proxy instead. .env.development (committed) already does this:
# *.local, not committed) with:
# VITE_API_BASE_URL=/api # VITE_API_BASE_URL=/api
# Leave this file's VITE_API_BASE_URL above as the real absolute URL - it's what # Leave this file's VITE_API_BASE_URL above as the real absolute URL - it's the fallback for
# BACKEND_PROXY_TARGET/production builds use *in general*. # any mode/deployment that doesn't override it.
# #
# IMPORTANT if `vite preview` is what's actually serving the production build on this same # The exact same mixed-content problem hits a production build too, if `vite preview` is what's
# box (see stax_dev_mode_is_the_real_slowness in project memory - as of 2026-08-15 that's how # actually serving it on this same box (see stax_dev_mode_is_the_real_slowness in project
# this app is deployed, port 5173 runs `vite preview` against `dist/`, not a separate # memory - as of 2026-08-15 that's how this app is deployed: port 5173 runs `vite preview`
# reverse-proxied host): `vite preview` reuses this same vite.config.ts proxy, but env # against `dist/`, not a separate reverse-proxied host). `vite preview` reuses vite.config.ts's
# resolution happens at BUILD time (`vite build`, mode=production), not at preview/serve time. # proxy, but env resolution happens at BUILD time (`vite build`, mode=production), not at
# Without an override, the absolute http:// URL above gets baked directly into the built JS # preview/serve time - .env.production (committed) supplies the same /api override for that
# bundle - mixed content blocks every single fetch from a browser once the page is https://, # case. If this app is ever deployed differently (a real reverse proxy/CDN in front, backend on
# which is silent (no server-side error to see) and looks exactly like "nothing works" or # HTTPS), delete or repoint .env.production rather than leaving a stale override in place.
# "can't sign in." Create .env.production.local (gitignored, not committed - a fresh checkout #
# needs this recreated) with the same override: # Either way: the env value is baked in at build time, not read fresh by an already-running
# VITE_API_BASE_URL=/api # preview server - `npm run build` again and restart `vite preview` after touching either
# then `npm run build` again and restart `vite preview` before assuming the fix landed - the # override file, or the old build keeps serving with the old value.
# env value is baked in at build time, not read fresh by the already-running preview server.
# This override is NOT needed for a real deployment where the backend itself is served over
# HTTPS and/or a separate reverse proxy/CDN sits in front - only for this same-box
# vite-preview-as-prod-server setup.
# There is no dev-only auto-login token pair anymore (removed 2026-08-15) - it was a # There is no dev-only auto-login token pair anymore (removed 2026-08-15) - it was a
# single-use, rotating refresh token baked into a static file and shared across every # single-use, rotating refresh token baked into a static file and shared across every
......
# Committed (not gitignored - see the .gitignore comment for why): route API calls through
# vite preview's own same-origin proxy (see vite.config.ts's server.proxy, which vite preview
# reuses) instead of the absolute http:// URL in plain .env - the browser blocks that as mixed
# content once the page itself is https://, exactly like in dev mode. This override exists
# because `vite preview` (serving this box's own build, through its own proxy) is how the
# production build actually gets served here - see stax_dev_mode_is_the_real_slowness in
# project memory. A real deployment behind its own reverse proxy/CDN with the backend on HTTPS
# wouldn't need this override; if this project ever moves to that, delete this file rather
# than leave a stale value here silently overriding the real one in .env.
VITE_API_BASE_URL=/api
...@@ -10,8 +10,13 @@ lerna-debug.log* ...@@ -10,8 +10,13 @@ lerna-debug.log*
node_modules node_modules
dist dist
dist-ssr dist-ssr
# Personal per-developer overrides only (e.g. .env.local) - genuine deployment config
# (.env, .env.development, .env.production) is committed on purpose, see .env.example's
# comment. None of it has held a secret since the dev auto-login token pair was removed
# 2026-08-15 - a URL and a proxy target aren't sensitive, and a fresh checkout silently
# missing them caused real, hard-to-diagnose outages (mixed-content blocked API calls with no
# server-side error) more than once that same day.
*.local *.local
.env
.cache .cache
# Editor directories and files # Editor directories and files
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment