Files
beacon-server/internal/api/admin.go
T
MrAlders0n 9bbf8efee5 release: v2.0.4 (#217)
* perf(routes): batch cross-IATA and hash route search (#216)

One search fired a /routes/cross request per IATA pair (138k on 2026-10-08). Route search now takes an optional iatas list and runs a fixed number of index-backed queries. /info advertises built-in minimum client versions.

* chore: bump version to 2.0.4
2026-10-09 22:17:23 -04:00

57 lines
1.8 KiB
Go

// Copyright 2026 Beacon Contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
package api
// AdminConfig is a whitelist of selected nonsecret running settings.
// It is not a serialization of the full file or environment configuration.
type AdminConfig struct {
Auth AdminAuthConfig `json:"auth"`
CORS AdminCORSConfig `json:"cors"`
Ingest AdminIngestConfig `json:"ingest"`
Mobile AdminMobileConfig `json:"mobile"`
Web AdminWebConfig `json:"web"`
}
type AdminMobileConfig struct {
MinAppVersion string `json:"min_app_version"` // effective floor; empty means no requirement
}
type AdminWebConfig struct {
MinWebVersion string `json:"min_web_version"` // effective floor; empty means no requirement
}
type AdminAuthConfig struct {
Configured bool `json:"configured"`
}
// AdminCORSConfig reports the current options supplied to the CORS middleware,
// with Beacon defaults applied, before that library's matching normalization.
type AdminCORSConfig struct {
AllowedOrigins []string `json:"allowed_origins"`
AllowedMethods []string `json:"allowed_methods"`
AllowedHeaders []string `json:"allowed_headers"`
AllowCredentials bool `json:"allow_credentials"`
MaxAge int `json:"max_age"`
}
type AdminIngestConfig struct {
// BrokerCount counts configured broker workers, not active MQTT connections
// or a configurable processing-worker pool.
BrokerCount int `json:"broker_count"`
}
type UpdateAdminConfigRequest struct {
CORS *UpdateAdminCORSRequest `json:"cors" validate:"required"`
}
type UpdateAdminCORSRequest struct {
AllowedOrigins *[]string `json:"allowed_origins" validate:"required"`
}
type UpdateAdminConfigResponse struct {
Config AdminConfig `json:"config"`
Persisted bool `json:"persisted"`
RequiresRestart bool `json:"requires_restart"`
}