- 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.
Telemt Panel (Web UI)
SvelteKit + shadcn-svelte. В production статика собирается и встраивается в образ шлюза (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 и при необходимости задайте URL.
Разработка (Vite отдельно от Go)
cd web
npm install
npm run dev
Откройте http://localhost:5173. В конфиге шлюза включите CORS для этого origin:
cors_allowed_origins:
- "http://localhost:5173"
Сборка только фронта
npm run build
Артефакт — каталог build/, при сборке Docker-образа шлюза он копируется в internal/webui/static/ и попадает в бинарник через embed.
Типы из OpenAPI агрегатов
npm run gen:api
Источник: ../docs/AGGREGATE_OPENAPI.yaml.
Ограничения
- Секреты upstream к Telemt задаются на шлюзе (
authorization_env), не в браузере. - Для мутаций из другого origin шлюз отдаёт нужные заголовки CORS (в т.ч. методы
POST,PATCH,DELETE).