diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..7ef2ea1 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,16 @@ +{ + "permissions": { + "allow": [ + "Bash(git checkout:*)", + "Bash(git add:*)", + "WebFetch(domain:localhost)", + "Bash(curl -s http://localhost:8000/api/settings/api-keys | head -50)", + "Bash(docker ps:*)", + "Bash(docker compose:*)", + "Bash(sleep 3 && curl -s http://localhost:3000/api/settings/api-keys | head -c 200)", + "Bash(sleep 4 && curl -s http://localhost:3000/api/settings/api-keys | head -c 200)", + "Bash(git commit:*)", + "WebSearch" + ] + } +} diff --git a/.mise.local.toml b/.mise.local.toml new file mode 100644 index 0000000..1eeeb78 --- /dev/null +++ b/.mise.local.toml @@ -0,0 +1,5 @@ +[env] +AIS_API_KEY="***REMOVED***" +OPENSKY_CLIENT_ID="***REMOVED***" +OPENSKY_CLIENT_SECRET="***REMOVED***" +BACKEND_URL="http://localhost:8000" \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 2b3fd73..82bd2f7 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -11,10 +11,6 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . ENV NEXT_TELEMETRY_DISABLED 1 -# NEXT_PUBLIC_* vars must exist at build time for Next.js to inline them. -# Default empty = auto-detect from browser hostname at runtime. -ARG NEXT_PUBLIC_API_URL="" -ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL RUN npm run build FROM base AS runner diff --git a/frontend/next.config.ts b/frontend/next.config.ts index bd8c994..6741f71 100644 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -1,9 +1,9 @@ import type { NextConfig } from "next"; -// BACKEND_URL is a plain (non-NEXT_PUBLIC_) env var read at server startup — -// not baked at build time — so it can be set in docker-compose `environment`. -// Defaults to localhost for local dev where both services run on the same host. -const backendUrl = process.env.BACKEND_URL ?? "http://localhost:8000"; +// /api/* requests are proxied to the backend by the catch-all route handler at +// src/app/api/[...path]/route.ts, which reads BACKEND_URL at request time. +// Do NOT add rewrites for /api/* here — next.config is evaluated at build time, +// so any URL baked in here ignores the runtime BACKEND_URL env var. const nextConfig: NextConfig = { transpilePackages: ['react-map-gl', 'mapbox-gl', 'maplibre-gl'], @@ -14,14 +14,6 @@ const nextConfig: NextConfig = { eslint: { ignoreDuringBuilds: true, }, - async rewrites() { - return [ - { - source: "/api/:path*", - destination: `${backendUrl}/api/:path*`, - }, - ]; - }, }; export default nextConfig;