Implement HTTP timeout configurations and enhance API documentation
- Added optional HTTP server timeout configurations (`HNHMAP_READ_TIMEOUT`, `HNHMAP_WRITE_TIMEOUT`, `HNHMAP_IDLE_TIMEOUT`) to `.env.example` and updated the server initialization in `main.go` to utilize these settings. - Enhanced API documentation for the `rebuildZooms` endpoint to clarify its background processing and polling mechanism for status updates. - Updated `configuration.md` to include new timeout environment variables for better configuration guidance. - Improved error handling in the client for large request bodies, ensuring appropriate responses for oversized payloads.
This commit is contained in:
@@ -40,7 +40,8 @@ The API is available under the `/map/api/` prefix. Requests requiring authentica
|
||||
- **POST /map/api/admin/maps/:id** — update a map (name, hidden, priority).
|
||||
- **POST /map/api/admin/maps/:id/toggle-hidden** — toggle map visibility.
|
||||
- **POST /map/api/admin/wipe** — wipe grids, markers, tiles, and maps from the database.
|
||||
- **POST /map/api/admin/rebuildZooms** — rebuild tile zoom levels from base tiles. The operation can take a long time (minutes) when there are many grids; the client should allow for request timeouts or show appropriate loading state. On success returns 200; on failure (e.g. store error) returns 500.
|
||||
- **POST /map/api/admin/rebuildZooms** — start rebuilding tile zoom levels from base tiles in the background. Returns **202 Accepted** immediately; the operation can take minutes when there are many grids. The client may poll **GET /map/api/admin/rebuildZooms/status** until `{"running": false}` and then refresh the map.
|
||||
- **GET /map/api/admin/rebuildZooms/status** — returns `{"running": true|false}` indicating whether a rebuild started via POST rebuildZooms is still in progress.
|
||||
- **GET /map/api/admin/export** — download data export (ZIP).
|
||||
- **POST /map/api/admin/merge** — upload and apply a merge (ZIP with grids and markers).
|
||||
- **GET /map/api/admin/wipeTile** — delete a tile. Query: `map`, `x`, `y`.
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|-----------------|-------------|---------|
|
||||
| `HNHMAP_PORT` | HTTP server port | 8080 |
|
||||
| `-port` | Same (command-line flag) | value of `HNHMAP_PORT` or 8080 |
|
||||
| `HNHMAP_READ_TIMEOUT` | HTTP server read timeout (e.g. `30s`) | 30s |
|
||||
| `HNHMAP_WRITE_TIMEOUT` | HTTP server write timeout (e.g. `60s`) | 60s |
|
||||
| `HNHMAP_IDLE_TIMEOUT` | HTTP server idle timeout (e.g. `120s`) | 120s |
|
||||
| `HNHMAP_BOOTSTRAP_PASSWORD` | Password for initial setup: when no users exist, logging in as `admin` with this password creates the first admin user | — |
|
||||
| `HNHMAP_BASE_URL` | Full application URL for OAuth redirect_uri (e.g. `https://map.example.com`). If not set, derived from `Host` and `X-Forwarded-*` headers | — |
|
||||
| `HNHMAP_OAUTH_GOOGLE_CLIENT_ID` | Google OAuth Client ID | — |
|
||||
|
||||
Reference in New Issue
Block a user