Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32e3af3e23 | ||
|
|
a5698c62bc |
2 changed files with 21 additions and 3 deletions
11
README.md
11
README.md
|
|
@ -91,6 +91,14 @@ pnpm dev:client # http://localhost:5173 (proxies /api
|
||||||
Open `http://localhost:5173/` for the tablet UI and
|
Open `http://localhost:5173/` for the tablet UI and
|
||||||
`http://localhost:5173/admin.html` for the backoffice.
|
`http://localhost:5173/admin.html` for the backoffice.
|
||||||
|
|
||||||
|
Running `dev:server` on a non-default `PORT`? Point `dev:client`'s proxy at it with
|
||||||
|
`WUTZ_SERVER_PORT` (same value as `PORT`):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
PORT=4000 ADMIN_PASSWORD=changeme pnpm dev:server
|
||||||
|
WUTZ_SERVER_PORT=4000 pnpm dev:client
|
||||||
|
```
|
||||||
|
|
||||||
## 📦 Production build
|
## 📦 Production build
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
@ -156,3 +164,6 @@ the service user owns the database directory automatically.
|
||||||
- `ADMIN_PASSWORD` (**required** for backoffice login)
|
- `ADMIN_PASSWORD` (**required** for backoffice login)
|
||||||
- `WUTZ_TZ` (default `Europe/Berlin`) — timezone for stats display and grouping
|
- `WUTZ_TZ` (default `Europe/Berlin`) — timezone for stats display and grouping
|
||||||
- `WUTZ_DAY_CUTOFF_HOUR` (default `5`) — sales before this local hour count toward the previous business day
|
- `WUTZ_DAY_CUTOFF_HOUR` (default `5`) — sales before this local hour count toward the previous business day
|
||||||
|
- `WUTZ_SERVER_PORT` (default `3000`, **client dev only** — not read by the server) — the port
|
||||||
|
`dev:client`'s Vite proxy targets; set it to match `dev:server`'s `PORT` when running the server
|
||||||
|
on something other than the default
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,13 @@ import preact from '@preact/preset-vite';
|
||||||
import legacy from '@vitejs/plugin-legacy';
|
import legacy from '@vitejs/plugin-legacy';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
|
||||||
|
// The dev-server proxy target — same default (3000) as the server's own
|
||||||
|
// `process.env.PORT ?? 3000` in server/src/index.ts. Override with
|
||||||
|
// `WUTZ_SERVER_PORT` when running `dev:server` on a non-default port, e.g.:
|
||||||
|
// PORT=4000 pnpm dev:server
|
||||||
|
// WUTZ_SERVER_PORT=4000 pnpm dev:client
|
||||||
|
const serverTarget = `http://localhost:${process.env.WUTZ_SERVER_PORT ?? 3000}`;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
preact(),
|
preact(),
|
||||||
|
|
@ -24,9 +31,9 @@ export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
port: 5173,
|
port: 5173,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': 'http://localhost:3000',
|
'/api': serverTarget,
|
||||||
'/admin': 'http://localhost:3000',
|
'/admin': serverTarget,
|
||||||
'/healthz': 'http://localhost:3000',
|
'/healthz': serverTarget,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue