Files
telemt-api/web/README.md
T
Denozordec d69849e5e2
Publish telemt-api gateway Docker image / test (push) Successful in 23s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 1m54s
Refactor Docker setup to integrate Web UI and streamline configuration
- Updated Dockerfile to build and embed the SvelteKit Web UI directly into the gateway image, eliminating the need for a separate web service.
- Modified .dockerignore to exclude unnecessary directories related to the web service.
- Adjusted config.compose.yaml to remove CORS settings for the web service, as the UI now shares the same origin as the API.
- Enhanced README.md to reflect the new single-port architecture for accessing both the Web UI and API.
- Removed the standalone web Dockerfile and updated related documentation for local development and build processes.
2026-03-30 10:42:28 +07:00

49 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Telemt Panel (Web UI)
SvelteKit + shadcn-svelte. В **production** статика собирается и **встраивается в образ шлюза** ([Dockerfile](../Dockerfile) в корне репозитория): панель и API на **одном порту** (например `http://127.0.0.1:8080/` — UI, `/api/…` — шлюз).
## Переменная `PUBLIC_TELEMT_GATEWAY_URL`
| Значение | Когда |
| --- | --- |
| *(пусто)* | Тот же хост и порт, что у страницы (Docker-образ шлюза, `npm run build` в Dockerfile с `ENV PUBLIC_TELEMT_GATEWAY_URL=`) |
| `http://127.0.0.1:8080` | Локальная разработка: Vite на `:5173`, шлюз на `:8080` |
Скопируйте [.env.example](.env.example) в `.env` и при необходимости задайте URL.
## Разработка (Vite отдельно от Go)
```powershell
cd web
npm install
npm run dev
```
Откройте `http://localhost:5173`. В конфиге шлюза включите [CORS](../docs/AGGREGATE.md) для этого origin:
```yaml
cors_allowed_origins:
- "http://localhost:5173"
```
## Сборка только фронта
```powershell
npm run build
```
Артефакт — каталог `build/`, при сборке **Docker-образа шлюза** он копируется в `internal/webui/static/` и попадает в бинарник через `embed`.
## Типы из OpenAPI агрегатов
```powershell
npm run gen:api
```
Источник: [../docs/AGGREGATE_OPENAPI.yaml](../docs/AGGREGATE_OPENAPI.yaml).
## Ограничения
- Секреты upstream к Telemt задаются на шлюзе (`authorization_env`), не в браузере.
- Для мутаций из другого origin шлюз отдаёт нужные заголовки CORS (в т.ч. методы `POST`, `PATCH`, `DELETE`).