Documentation
¶
Overview ¶
Package management provides the management API handlers and middleware for configuring the server and managing auth files.
Index ¶
- func WriteOAuthCallbackFileForPendingSession(authDir, provider, state, code, errorMessage string) (string, error)
- type Handler
- func (h *Handler) APICall(c *gin.Context)
- func (h *Handler) DeleteAPIKeyAlias(c *gin.Context)
- func (h *Handler) DeleteAPIKeys(c *gin.Context)
- func (h *Handler) DeleteAmpModelMappings(c *gin.Context)
- func (h *Handler) DeleteAmpUpstreamAPIKey(c *gin.Context)
- func (h *Handler) DeleteAmpUpstreamAPIKeys(c *gin.Context)
- func (h *Handler) DeleteAmpUpstreamURL(c *gin.Context)
- func (h *Handler) DeleteAuthFile(c *gin.Context)
- func (h *Handler) DeleteClaudeKey(c *gin.Context)
- func (h *Handler) DeleteCodexKey(c *gin.Context)
- func (h *Handler) DeleteGeminiKey(c *gin.Context)
- func (h *Handler) DeleteLogs(c *gin.Context)
- func (h *Handler) DeleteOAuthExcludedModels(c *gin.Context)
- func (h *Handler) DeleteOAuthModelAlias(c *gin.Context)
- func (h *Handler) DeleteOpenAICompat(c *gin.Context)
- func (h *Handler) DeleteProxyURL(c *gin.Context)
- func (h *Handler) DeleteVertexCompatKey(c *gin.Context)
- func (h *Handler) DownloadAuthFile(c *gin.Context)
- func (h *Handler) DownloadRequestErrorLog(c *gin.Context)
- func (h *Handler) ExportUsageStatistics(c *gin.Context)
- func (h *Handler) GetAPIKeyAliases(c *gin.Context)
- func (h *Handler) GetAPIKeys(c *gin.Context)
- func (h *Handler) GetAmpCode(c *gin.Context)
- func (h *Handler) GetAmpForceModelMappings(c *gin.Context)
- func (h *Handler) GetAmpModelMappings(c *gin.Context)
- func (h *Handler) GetAmpRestrictManagementToLocalhost(c *gin.Context)
- func (h *Handler) GetAmpUpstreamAPIKey(c *gin.Context)
- func (h *Handler) GetAmpUpstreamAPIKeys(c *gin.Context)
- func (h *Handler) GetAmpUpstreamURL(c *gin.Context)
- func (h *Handler) GetAuthFileModels(c *gin.Context)
- func (h *Handler) GetAuthStatus(c *gin.Context)
- func (h *Handler) GetAutoRefreshInterval(c *gin.Context)
- func (h *Handler) GetClaudeKeys(c *gin.Context)
- func (h *Handler) GetCodexKeys(c *gin.Context)
- func (h *Handler) GetConfig(c *gin.Context)
- func (h *Handler) GetConfigYAML(c *gin.Context)
- func (h *Handler) GetDebug(c *gin.Context)
- func (h *Handler) GetErrorLogsMaxFiles(c *gin.Context)
- func (h *Handler) GetForceModelPrefix(c *gin.Context)
- func (h *Handler) GetGeminiKeys(c *gin.Context)
- func (h *Handler) GetLatestVersion(c *gin.Context)
- func (h *Handler) GetLoggingToFile(c *gin.Context)
- func (h *Handler) GetLogs(c *gin.Context)
- func (h *Handler) GetLogsMaxTotalSizeMB(c *gin.Context)
- func (h *Handler) GetMaxRetryInterval(c *gin.Context)
- func (h *Handler) GetModelPrices(c *gin.Context)
- func (h *Handler) GetOAuthExcludedModels(c *gin.Context)
- func (h *Handler) GetOAuthModelAlias(c *gin.Context)
- func (h *Handler) GetOpenAICompat(c *gin.Context)
- func (h *Handler) GetProxyURL(c *gin.Context)
- func (h *Handler) GetReleases(c *gin.Context)
- func (h *Handler) GetRequestErrorLogs(c *gin.Context)
- func (h *Handler) GetRequestLog(c *gin.Context)
- func (h *Handler) GetRequestLogByID(c *gin.Context)
- func (h *Handler) GetRequestRetry(c *gin.Context)
- func (h *Handler) GetRoutingStrategy(c *gin.Context)
- func (h *Handler) GetStaticModelDefinitions(c *gin.Context)
- func (h *Handler) GetSwitchPreviewModel(c *gin.Context)
- func (h *Handler) GetSwitchProject(c *gin.Context)
- func (h *Handler) GetUpdateStatus(c *gin.Context)
- func (h *Handler) GetUsageEvents(c *gin.Context)
- func (h *Handler) GetUsageRetention(c *gin.Context)
- func (h *Handler) GetUsageStatistics(c *gin.Context)
- func (h *Handler) GetUsageStatisticsEnabled(c *gin.Context)
- func (h *Handler) GetUsageSummary(c *gin.Context)
- func (h *Handler) GetVertexCompatKeys(c *gin.Context)
- func (h *Handler) GetWebsocketAuth(c *gin.Context)
- func (h *Handler) ImportUsageStatistics(c *gin.Context)
- func (h *Handler) ImportVertexCredential(c *gin.Context)
- func (h *Handler) ListAuthFiles(c *gin.Context)
- func (h *Handler) Middleware() gin.HandlerFunc
- func (h *Handler) PatchAPIKeyAlias(c *gin.Context)
- func (h *Handler) PatchAPIKeys(c *gin.Context)
- func (h *Handler) PatchAmpModelMappings(c *gin.Context)
- func (h *Handler) PatchAmpUpstreamAPIKeys(c *gin.Context)
- func (h *Handler) PatchAuthFileFields(c *gin.Context)
- func (h *Handler) PatchAuthFileStatus(c *gin.Context)
- func (h *Handler) PatchClaudeKey(c *gin.Context)
- func (h *Handler) PatchCodexKey(c *gin.Context)
- func (h *Handler) PatchGeminiKey(c *gin.Context)
- func (h *Handler) PatchOAuthExcludedModels(c *gin.Context)
- func (h *Handler) PatchOAuthModelAlias(c *gin.Context)
- func (h *Handler) PatchOpenAICompat(c *gin.Context)
- func (h *Handler) PatchVertexCompatKey(c *gin.Context)
- func (h *Handler) PostOAuthCallback(c *gin.Context)
- func (h *Handler) PostPanelUpdate(c *gin.Context)
- func (h *Handler) PostUpdate(c *gin.Context)
- func (h *Handler) PutAPIKeyAliases(c *gin.Context)
- func (h *Handler) PutAPIKeys(c *gin.Context)
- func (h *Handler) PutAmpForceModelMappings(c *gin.Context)
- func (h *Handler) PutAmpModelMappings(c *gin.Context)
- func (h *Handler) PutAmpRestrictManagementToLocalhost(c *gin.Context)
- func (h *Handler) PutAmpUpstreamAPIKey(c *gin.Context)
- func (h *Handler) PutAmpUpstreamAPIKeys(c *gin.Context)
- func (h *Handler) PutAmpUpstreamURL(c *gin.Context)
- func (h *Handler) PutAutoRefreshInterval(c *gin.Context)
- func (h *Handler) PutClaudeKeys(c *gin.Context)
- func (h *Handler) PutCodexKeys(c *gin.Context)
- func (h *Handler) PutConfigYAML(c *gin.Context)
- func (h *Handler) PutDebug(c *gin.Context)
- func (h *Handler) PutErrorLogsMaxFiles(c *gin.Context)
- func (h *Handler) PutForceModelPrefix(c *gin.Context)
- func (h *Handler) PutGeminiKeys(c *gin.Context)
- func (h *Handler) PutLoggingToFile(c *gin.Context)
- func (h *Handler) PutLogsMaxTotalSizeMB(c *gin.Context)
- func (h *Handler) PutMaxRetryInterval(c *gin.Context)
- func (h *Handler) PutModelPrices(c *gin.Context)
- func (h *Handler) PutOAuthExcludedModels(c *gin.Context)
- func (h *Handler) PutOAuthModelAlias(c *gin.Context)
- func (h *Handler) PutOpenAICompat(c *gin.Context)
- func (h *Handler) PutProxyURL(c *gin.Context)
- func (h *Handler) PutRequestLog(c *gin.Context)
- func (h *Handler) PutRequestRetry(c *gin.Context)
- func (h *Handler) PutRoutingStrategy(c *gin.Context)
- func (h *Handler) PutSwitchPreviewModel(c *gin.Context)
- func (h *Handler) PutSwitchProject(c *gin.Context)
- func (h *Handler) PutUsageRetention(c *gin.Context)
- func (h *Handler) PutUsageStatisticsEnabled(c *gin.Context)
- func (h *Handler) PutVertexCompatKeys(c *gin.Context)
- func (h *Handler) PutWebsocketAuth(c *gin.Context)
- func (h *Handler) RequestAnthropicToken(c *gin.Context)
- func (h *Handler) RequestAntigravityToken(c *gin.Context)
- func (h *Handler) RequestCodexToken(c *gin.Context)
- func (h *Handler) RequestGeminiCLIToken(c *gin.Context)
- func (h *Handler) RequestIFlowCookieToken(c *gin.Context)
- func (h *Handler) RequestIFlowToken(c *gin.Context)
- func (h *Handler) RequestKimiToken(c *gin.Context)
- func (h *Handler) RequestQwenToken(c *gin.Context)
- func (h *Handler) SetAuthManager(manager *coreauth.Manager)
- func (h *Handler) SetConfig(cfg *config.Config)
- func (h *Handler) SetLocalPassword(password string)
- func (h *Handler) SetLogDirectory(dir string)
- func (h *Handler) SetPostAuthHook(hook coreauth.PostAuthHook)
- func (h *Handler) SetUsagePersister(p *usage.Persister)
- func (h *Handler) SetUsageStatistics(stats *usage.RequestStatistics)
- func (h *Handler) TrimPreviewUsageStatistics(c *gin.Context)
- func (h *Handler) TrimUsageStatistics(c *gin.Context)
- func (h *Handler) UploadAuthFile(c *gin.Context)
- func (h *Handler) ValidateConfigYAML(c *gin.Context)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler aggregates config reference, persistence path and helpers.
func NewHandler ¶
func NewHandler(cfg *config.Config, configFilePath string, manager *coreauth.Manager, opts ...Option) *Handler
NewHandler creates a new management handler instance.
func NewHandlerWithoutConfigFilePath ¶
func NewHandlerWithoutConfigFilePath(cfg *config.Config, manager *coreauth.Manager, opts ...Option) *Handler
NewHandlerWithoutConfigFilePath creates a management handler without a config file path.
func (*Handler) APICall ¶
APICall makes a generic HTTP request on behalf of the management API caller. It is protected by the management middleware.
Endpoint:
POST /v0/management/api-call
Authentication:
Same as other management APIs (requires a management key and remote-management rules). You can provide the key via: - Authorization: Bearer <key> - X-Management-Key: <key>
Request JSON:
- auth_index / authIndex / AuthIndex (optional): The credential "auth_index" from GET /v0/management/auth-files (or other endpoints returning it). If omitted or not found, credential-specific proxy/token substitution is skipped.
- method (required): HTTP method, e.g. GET, POST, PUT, PATCH, DELETE.
- url (required): Absolute URL including scheme and host, e.g. "https://api.example.com/v1/ping".
- header (optional): Request headers map. Supports magic variable "$TOKEN$" which is replaced using the selected credential: 1) metadata.access_token 2) attributes.api_key 3) metadata.token / metadata.id_token / metadata.cookie Example: {"Authorization":"Bearer $TOKEN$"}. Note: if you need to override the HTTP Host header, set header["Host"].
- data (optional): Raw request body as string (useful for POST/PUT/PATCH).
Proxy selection (highest priority first):
- Selected credential proxy_url
- Global config proxy-url
- Direct connect (environment proxies are not used)
Response JSON (returned with HTTP 200 when the APICall itself succeeds):
- status_code: Upstream HTTP status code.
- header: Upstream response headers.
- body: Upstream response body as string.
Example:
curl -sS -X POST "http://127.0.0.1:8317/v0/management/api-call" \
-H "Authorization: Bearer <MANAGEMENT_KEY>" \
-H "Content-Type: application/json" \
-d '{"auth_index":"<AUTH_INDEX>","method":"GET",
"url":"https://api.example.com/v1/ping",
"header":{"Authorization":"Bearer $TOKEN$"}}'
curl -sS -X POST "http://127.0.0.1:8317/v0/management/api-call" \
-H "Authorization: Bearer 831227" \
-H "Content-Type: application/json" \
-d '{"auth_index":"<AUTH_INDEX>","method":"POST",
"url":"https://api.example.com/v1/fetchAvailableModels",
"header":{"Authorization":"Bearer $TOKEN$",
"Content-Type":"application/json",
"User-Agent":"cliproxyapi"},
"data":"{}"}'
func (*Handler) DeleteAPIKeyAlias ¶
func (*Handler) DeleteAPIKeys ¶
func (*Handler) DeleteAmpModelMappings ¶
DeleteAmpModelMappings removes specified model mappings by "from" field.
func (*Handler) DeleteAmpUpstreamAPIKey ¶
DeleteAmpUpstreamAPIKey clears the ampcode upstream API key.
func (*Handler) DeleteAmpUpstreamAPIKeys ¶
DeleteAmpUpstreamAPIKeys removes specified upstream API keys entries. Body must be JSON: {"value": ["<upstream-api-key>", ...]}. If "value" is an empty array, clears all entries. If JSON is invalid or "value" is missing/null, returns 400 and does not persist any change.
func (*Handler) DeleteAmpUpstreamURL ¶
DeleteAmpUpstreamURL clears the ampcode upstream URL.
func (*Handler) DeleteAuthFile ¶
DeleteAuthFile deletes auth files: single by name or all.
func (*Handler) DeleteClaudeKey ¶
func (*Handler) DeleteCodexKey ¶
func (*Handler) DeleteGeminiKey ¶
func (*Handler) DeleteLogs ¶
DeleteLogs removes all rotated log files and truncates the active log.
func (*Handler) DeleteOAuthExcludedModels ¶
func (*Handler) DeleteOAuthModelAlias ¶
func (*Handler) DeleteOpenAICompat ¶
func (*Handler) DeleteProxyURL ¶
func (*Handler) DeleteVertexCompatKey ¶
func (*Handler) DownloadAuthFile ¶
DownloadAuthFile downloads a single auth file by name.
func (*Handler) DownloadRequestErrorLog ¶
DownloadRequestErrorLog downloads a specific error request log file by name.
func (*Handler) ExportUsageStatistics ¶
ExportUsageStatistics returns a complete usage snapshot for backup/migration.
func (*Handler) GetAPIKeyAliases ¶
func (*Handler) GetAPIKeys ¶
func (*Handler) GetAmpCode ¶
GetAmpCode returns the complete ampcode configuration.
func (*Handler) GetAmpForceModelMappings ¶
GetAmpForceModelMappings returns whether model mappings are forced.
func (*Handler) GetAmpModelMappings ¶
GetAmpModelMappings returns the ampcode model mappings.
func (*Handler) GetAmpRestrictManagementToLocalhost ¶
GetAmpRestrictManagementToLocalhost returns the localhost restriction setting.
func (*Handler) GetAmpUpstreamAPIKey ¶
GetAmpUpstreamAPIKey returns the ampcode upstream API key.
func (*Handler) GetAmpUpstreamAPIKeys ¶
GetAmpUpstreamAPIKeys returns the ampcode upstream API keys mapping.
func (*Handler) GetAmpUpstreamURL ¶
GetAmpUpstreamURL returns the ampcode upstream URL.
func (*Handler) GetAuthFileModels ¶
GetAuthFileModels returns the models supported by a specific auth file
func (*Handler) GetAuthStatus ¶
func (*Handler) GetAutoRefreshInterval ¶
GetAutoRefreshInterval returns the auto refresh interval.
func (*Handler) GetClaudeKeys ¶
func (*Handler) GetCodexKeys ¶
func (*Handler) GetConfigYAML ¶
GetConfigYAML returns the raw config.yaml file bytes without re-encoding. It preserves comments and original formatting/styles.
func (*Handler) GetErrorLogsMaxFiles ¶
GetErrorLogsMaxFiles returns the error logs max files count.
func (*Handler) GetForceModelPrefix ¶
GetForceModelPrefix returns the force model prefix flag.
func (*Handler) GetGeminiKeys ¶
func (*Handler) GetLatestVersion ¶
GetLatestVersion returns the latest release version from GitHub without downloading assets.
func (*Handler) GetLoggingToFile ¶
GetLoggingToFile returns the logging-to-file flag.
func (*Handler) GetLogsMaxTotalSizeMB ¶
GetLogsMaxTotalSizeMB returns the logs max total size in MB.
func (*Handler) GetMaxRetryInterval ¶
GetMaxRetryInterval returns the max retry interval.
func (*Handler) GetModelPrices ¶
GetModelPrices returns the stored model pricing configuration.
func (*Handler) GetOAuthExcludedModels ¶
func (*Handler) GetOAuthModelAlias ¶
func (*Handler) GetOpenAICompat ¶
func (*Handler) GetProxyURL ¶
GetProxyURL returns the proxy URL.
func (*Handler) GetReleases ¶
GetReleases proxies the GitHub Releases API with a 15-minute cache. Query params: page (default 1), per_page (default 30, max 100).
func (*Handler) GetRequestErrorLogs ¶
GetRequestErrorLogs lists error request log files when RequestLog is disabled. It returns an empty list when RequestLog is enabled.
func (*Handler) GetRequestLog ¶
GetRequestLog returns the request log flag.
func (*Handler) GetRequestLogByID ¶
GetRequestLogByID finds and downloads a request log file by its request ID. The ID is matched against the suffix of log file names (format: *-{requestID}.log).
func (*Handler) GetRequestRetry ¶
GetRequestRetry returns the request retry count.
func (*Handler) GetRoutingStrategy ¶
GetRoutingStrategy returns the routing strategy.
func (*Handler) GetStaticModelDefinitions ¶
GetStaticModelDefinitions returns static model metadata for a given channel. Channel is provided via path param (:channel) or query param (?channel=...).
func (*Handler) GetSwitchPreviewModel ¶
func (*Handler) GetSwitchProject ¶
func (*Handler) GetUpdateStatus ¶
GetUpdateStatus returns the current self-update progress.
func (*Handler) GetUsageEvents ¶
GetUsageEvents returns paginated usage event details.
GET /v0/management/usage/events?from=...&to=...&page=1&page_size=50
&model=...&source=...&search=...&sort=timestamp&order=desc
func (*Handler) GetUsageRetention ¶
GetUsageRetention returns the current retention configuration.
func (*Handler) GetUsageStatistics ¶
GetUsageStatistics returns the in-memory request statistics snapshot. With v2 storage, this returns only today's data via the persister.
func (*Handler) GetUsageStatisticsEnabled ¶
GetUsageStatisticsEnabled returns the usage statistics enabled flag.
func (*Handler) GetUsageSummary ¶
GetUsageSummary returns aggregated usage data for dashboard rendering.
GET /v0/management/usage/summary?from=...&to=...&granularity=hourly|daily
func (*Handler) GetVertexCompatKeys ¶
func (*Handler) GetWebsocketAuth ¶
GetWebsocketAuth returns the websocket auth flag.
func (*Handler) ImportUsageStatistics ¶
ImportUsageStatistics merges a previously exported usage snapshot into memory.
func (*Handler) ImportVertexCredential ¶
ImportVertexCredential handles uploading a Vertex service account JSON and saving it as an auth record.
func (*Handler) ListAuthFiles ¶
func (*Handler) Middleware ¶
func (h *Handler) Middleware() gin.HandlerFunc
Middleware enforces access control for management endpoints. All requests (local and remote) require a valid management key. Additionally, remote access requires allow-remote-management=true.
func (*Handler) PatchAPIKeyAlias ¶
func (*Handler) PatchAPIKeys ¶
func (*Handler) PatchAmpModelMappings ¶
PatchAmpModelMappings adds or updates model mappings.
func (*Handler) PatchAmpUpstreamAPIKeys ¶
PatchAmpUpstreamAPIKeys adds or updates upstream API keys entries. Matching is done by upstream-api-key value.
func (*Handler) PatchAuthFileFields ¶
PatchAuthFileFields updates editable fields (prefix, proxy_url, priority) of an auth file.
func (*Handler) PatchAuthFileStatus ¶
PatchAuthFileStatus toggles the disabled state of an auth file
func (*Handler) PatchClaudeKey ¶
func (*Handler) PatchCodexKey ¶
func (*Handler) PatchGeminiKey ¶
func (*Handler) PatchOAuthExcludedModels ¶
func (*Handler) PatchOAuthModelAlias ¶
func (*Handler) PatchOpenAICompat ¶
func (*Handler) PatchVertexCompatKey ¶
func (*Handler) PostOAuthCallback ¶
func (*Handler) PostPanelUpdate ¶
PostPanelUpdate triggers an immediate refresh of the management panel HTML asset.
func (*Handler) PostUpdate ¶
PostUpdate triggers a self-update to the specified version.
func (*Handler) PutAPIKeyAliases ¶
func (*Handler) PutAPIKeys ¶
func (*Handler) PutAmpForceModelMappings ¶
PutAmpForceModelMappings updates the force model mappings setting.
func (*Handler) PutAmpModelMappings ¶
PutAmpModelMappings replaces all ampcode model mappings.
func (*Handler) PutAmpRestrictManagementToLocalhost ¶
PutAmpRestrictManagementToLocalhost updates the localhost restriction setting.
func (*Handler) PutAmpUpstreamAPIKey ¶
PutAmpUpstreamAPIKey updates the ampcode upstream API key.
func (*Handler) PutAmpUpstreamAPIKeys ¶
PutAmpUpstreamAPIKeys replaces all ampcode upstream API keys mappings.
func (*Handler) PutAmpUpstreamURL ¶
PutAmpUpstreamURL updates the ampcode upstream URL.
func (*Handler) PutAutoRefreshInterval ¶
func (*Handler) PutClaudeKeys ¶
func (*Handler) PutCodexKeys ¶
func (*Handler) PutConfigYAML ¶
func (*Handler) PutErrorLogsMaxFiles ¶
func (*Handler) PutForceModelPrefix ¶
func (*Handler) PutGeminiKeys ¶
func (*Handler) PutLoggingToFile ¶
func (*Handler) PutLogsMaxTotalSizeMB ¶
func (*Handler) PutMaxRetryInterval ¶
func (*Handler) PutModelPrices ¶
PutModelPrices replaces the stored model pricing configuration.
func (*Handler) PutOAuthExcludedModels ¶
func (*Handler) PutOAuthModelAlias ¶
func (*Handler) PutOpenAICompat ¶
func (*Handler) PutProxyURL ¶
func (*Handler) PutRequestLog ¶
func (*Handler) PutRequestRetry ¶
func (*Handler) PutRoutingStrategy ¶
func (*Handler) PutSwitchPreviewModel ¶
func (*Handler) PutSwitchProject ¶
func (*Handler) PutUsageRetention ¶
PutUsageRetention updates the retention configuration.
func (*Handler) PutUsageStatisticsEnabled ¶
func (*Handler) PutVertexCompatKeys ¶
func (*Handler) PutWebsocketAuth ¶
func (*Handler) RequestAnthropicToken ¶
func (*Handler) RequestAntigravityToken ¶
func (*Handler) RequestCodexToken ¶
func (*Handler) RequestGeminiCLIToken ¶
func (*Handler) RequestIFlowCookieToken ¶
func (*Handler) RequestIFlowToken ¶
func (*Handler) RequestKimiToken ¶
func (*Handler) RequestQwenToken ¶
func (*Handler) SetAuthManager ¶
SetAuthManager updates the auth manager reference used by management endpoints.
func (*Handler) SetConfig ¶
SetConfig updates the in-memory config reference when the server hot-reloads.
func (*Handler) SetLocalPassword ¶
SetLocalPassword configures the runtime-local password accepted for localhost requests.
func (*Handler) SetLogDirectory ¶
SetLogDirectory updates the directory where main.log should be looked up.
func (*Handler) SetPostAuthHook ¶
func (h *Handler) SetPostAuthHook(hook coreauth.PostAuthHook)
SetPostAuthHook registers a hook to be called after auth record creation but before persistence.
func (*Handler) SetUsagePersister ¶
SetUsagePersister sets the usage statistics persister reference.
func (*Handler) SetUsageStatistics ¶
func (h *Handler) SetUsageStatistics(stats *usage.RequestStatistics)
SetUsageStatistics allows replacing the usage statistics reference.
func (*Handler) TrimPreviewUsageStatistics ¶
TrimPreviewUsageStatistics returns a preview of what would be cleaned by Trim.
func (*Handler) TrimUsageStatistics ¶
TrimUsageStatistics triggers an immediate cleanup of expired details.
func (*Handler) UploadAuthFile ¶
UploadAuthFile uploads an auth file via multipart or raw JSON with ?name= parameter.
func (*Handler) ValidateConfigYAML ¶
ValidateConfigYAML validates a YAML config body without saving.
type Option ¶
type Option func(*Handler)
Option configures a Handler.
func WithEnvSecret ¶
WithEnvSecret overrides the management password (default: from MANAGEMENT_PASSWORD env).
func WithTokenStore ¶
WithTokenStore overrides the token store.
func WithUsagePersister ¶
WithUsagePersister sets the usage persister.
func WithUsageStats ¶
func WithUsageStats(stats *usage.RequestStatistics) Option
WithUsageStats overrides the usage statistics source.