configure local dev api endpoint

This commit is contained in:
dirtydishes 2026-06-13 03:39:37 -04:00
parent 69058b8ceb
commit 4446b228d7
5 changed files with 506 additions and 4 deletions

View file

@ -280,7 +280,7 @@ bun run make:desktop
Desktop-specific environment:
- `ISLANDFLOW_DESKTOP_START_URL` is only used by the Electron shell and is restricted to trusted Islandflow app origins.
- `NEXT_PUBLIC_API_URL` remains the web app API/WebSocket origin control and usually points at `https://flow.deltaisland.io` when developing local UI inside Electron.
- `NEXT_PUBLIC_API_URL` remains the web app API/WebSocket origin control and usually points at `https://api.flow.deltaisland.io` when developing local UI inside Electron.
## Environment Configuration
@ -406,7 +406,7 @@ Default `smart-money` policy rejects lower-information prints and keeps higher-c
| `LIVE_LIMIT_OPTIONS` | `1000` | Live cache depth for options channel unless overridden. |
| `LIVE_LIMIT_ALERTS` | `300` | Live cache depth for alerts channel unless overridden. |
| `LIVE_LIMIT_NEWS` | `100` | Live cache depth for news channel unless overridden. |
| `NEXT_PUBLIC_API_URL` | auto-detected in browser, `http://127.0.0.1:4000` fallback | Explicit base URL for API/WS calls from the web app. |
| `NEXT_PUBLIC_API_URL` | `https://api.flow.deltaisland.io` for local web dev, auto-detected in browser when unset by other runners | Explicit base URL for API/WS calls from the web app. |
| `NEXT_PUBLIC_LIVE_HOT_WINDOW` | `600` | Max hot-window items retained for non-options live streams in UI state. |
| `NEXT_PUBLIC_LIVE_HOT_WINDOW_OPTIONS` | `1200` | Dedicated max hot-window items retained for options prints. |
| `NEXT_PUBLIC_NBBO_MAX_AGE_MS` | `1000` | Frontend NBBO staleness threshold. |

View file

@ -25,5 +25,5 @@ This workspace packages a thin Electron shell around the hosted Islandflow app.
## Development Notes
- `ISLANDFLOW_DESKTOP_START_URL` controls which trusted app URL Electron loads. Prefer `/options` for deep links; `/tape` remains supported and redirects in the web app for compatibility.
- `NEXT_PUBLIC_API_URL` remains a web-app setting and should typically be `https://flow.deltaisland.io` when developing the local UI inside Electron.
- `NEXT_PUBLIC_API_URL` remains a web-app setting and should typically be `https://api.flow.deltaisland.io` when developing the local UI inside Electron.
- `assets/` currently contains placeholders only; a real `.icns` icon is deferred.

View file

@ -1,9 +1,16 @@
import { rm } from "node:fs/promises";
const DEFAULT_REMOTE_API_URL = "https://api.flow.deltaisland.io";
const run = async () => {
const port = 3000;
const distDir = ".next-dev";
console.log(`[web] starting Next.js dev server on port ${port}`);
console.log(
`[web] API origin: ${Bun.env.NEXT_PUBLIC_API_URL ?? DEFAULT_REMOTE_API_URL}${
Bun.env.NEXT_PUBLIC_API_URL ? " (from NEXT_PUBLIC_API_URL)" : " (default)"
}`
);
const path = Bun.env.PATH ?? "";
const cwd = `${import.meta.dir}/..`;
@ -21,6 +28,7 @@ const run = async () => {
env: {
...Bun.env,
PATH: `${cwd}/node_modules/.bin:${path}`,
NEXT_PUBLIC_API_URL: Bun.env.NEXT_PUBLIC_API_URL ?? DEFAULT_REMOTE_API_URL,
PORT: String(port)
}
});

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@ import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
import path from "node:path";
const DESKTOP_REMOTE_URL = "https://flow.deltaisland.io";
const DESKTOP_REMOTE_API_URL = "https://api.flow.deltaisland.io";
const DESKTOP_LOCAL_URL = "http://127.0.0.1:3000";
const WEB_PORT = 3000;
@ -268,7 +269,7 @@ if (!remoteMode) {
cmd: ["bun", "run", "dev"],
cwd: "apps/web",
env: {
NEXT_PUBLIC_API_URL: Bun.env.NEXT_PUBLIC_API_URL ?? DESKTOP_REMOTE_URL
NEXT_PUBLIC_API_URL: Bun.env.NEXT_PUBLIC_API_URL ?? DESKTOP_REMOTE_API_URL
}
});
await waitForWebPort();