management

package
v6.2.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 38 Imported by: 0

Documentation

Overview

Package management provides the management API handlers and middleware for configuring the server and managing auth files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteConfig added in v6.2.25

func WriteConfig(path string, data []byte) error

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) *Handler

NewHandler creates a new management handler instance.

func (*Handler) DeleteAPIKeys

func (h *Handler) DeleteAPIKeys(c *gin.Context)

func (*Handler) DeleteAuthFile

func (h *Handler) DeleteAuthFile(c *gin.Context)

Delete auth files: single by name or all

func (*Handler) DeleteClaudeKey

func (h *Handler) DeleteClaudeKey(c *gin.Context)

func (*Handler) DeleteCodexKey

func (h *Handler) DeleteCodexKey(c *gin.Context)

func (*Handler) DeleteGlKeys

func (h *Handler) DeleteGlKeys(c *gin.Context)

func (*Handler) DeleteLogs added in v6.2.14

func (h *Handler) DeleteLogs(c *gin.Context)

DeleteLogs removes all rotated log files and truncates the active log.

func (*Handler) DeleteOpenAICompat

func (h *Handler) DeleteOpenAICompat(c *gin.Context)

func (*Handler) DeleteProxyURL

func (h *Handler) DeleteProxyURL(c *gin.Context)

func (*Handler) DownloadAuthFile

func (h *Handler) DownloadAuthFile(c *gin.Context)

Download single auth file by name

func (*Handler) GetAPIKeys

func (h *Handler) GetAPIKeys(c *gin.Context)

api-keys

func (*Handler) GetAuthStatus

func (h *Handler) GetAuthStatus(c *gin.Context)

func (*Handler) GetClaudeKeys

func (h *Handler) GetClaudeKeys(c *gin.Context)

claude-api-key: []ClaudeKey

func (*Handler) GetCodexKeys

func (h *Handler) GetCodexKeys(c *gin.Context)

codex-api-key: []CodexKey

func (*Handler) GetConfig

func (h *Handler) GetConfig(c *gin.Context)

func (*Handler) GetConfigFile added in v6.2.25

func (h *Handler) GetConfigFile(c *gin.Context)

GetConfigFile returns the raw config.yaml file bytes without re-encoding. It preserves comments and original formatting/styles.

func (*Handler) GetConfigYAML added in v6.2.25

func (h *Handler) GetConfigYAML(c *gin.Context)

func (*Handler) GetDebug

func (h *Handler) GetDebug(c *gin.Context)

Debug

func (*Handler) GetGlKeys

func (h *Handler) GetGlKeys(c *gin.Context)

generative-language-api-key

func (*Handler) GetLoggingToFile added in v6.0.5

func (h *Handler) GetLoggingToFile(c *gin.Context)

UsageStatisticsEnabled

func (*Handler) GetLogs added in v6.2.14

func (h *Handler) GetLogs(c *gin.Context)

GetLogs returns log lines with optional incremental loading.

func (*Handler) GetOpenAICompat

func (h *Handler) GetOpenAICompat(c *gin.Context)

openai-compatibility: []OpenAICompatibility

func (*Handler) GetProxyURL

func (h *Handler) GetProxyURL(c *gin.Context)

Proxy URL

func (*Handler) GetRequestLog

func (h *Handler) GetRequestLog(c *gin.Context)

Request log

func (*Handler) GetRequestRetry

func (h *Handler) GetRequestRetry(c *gin.Context)

Request retry

func (*Handler) GetSwitchPreviewModel

func (h *Handler) GetSwitchPreviewModel(c *gin.Context)

func (*Handler) GetSwitchProject

func (h *Handler) GetSwitchProject(c *gin.Context)

Quota exceeded toggles

func (*Handler) GetUsageStatistics

func (h *Handler) GetUsageStatistics(c *gin.Context)

GetUsageStatistics returns the in-memory request statistics snapshot.

func (*Handler) GetUsageStatisticsEnabled added in v6.0.5

func (h *Handler) GetUsageStatisticsEnabled(c *gin.Context)

UsageStatisticsEnabled

func (*Handler) ListAuthFiles

func (h *Handler) ListAuthFiles(c *gin.Context)

List auth files

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) PatchAPIKeys

func (h *Handler) PatchAPIKeys(c *gin.Context)

func (*Handler) PatchClaudeKey

func (h *Handler) PatchClaudeKey(c *gin.Context)

func (*Handler) PatchCodexKey

func (h *Handler) PatchCodexKey(c *gin.Context)

func (*Handler) PatchGlKeys

func (h *Handler) PatchGlKeys(c *gin.Context)

func (*Handler) PatchOpenAICompat

func (h *Handler) PatchOpenAICompat(c *gin.Context)

func (*Handler) PutAPIKeys

func (h *Handler) PutAPIKeys(c *gin.Context)

func (*Handler) PutClaudeKeys

func (h *Handler) PutClaudeKeys(c *gin.Context)

func (*Handler) PutCodexKeys

func (h *Handler) PutCodexKeys(c *gin.Context)

func (*Handler) PutConfigYAML added in v6.2.25

func (h *Handler) PutConfigYAML(c *gin.Context)

func (*Handler) PutDebug

func (h *Handler) PutDebug(c *gin.Context)

func (*Handler) PutGlKeys

func (h *Handler) PutGlKeys(c *gin.Context)

func (*Handler) PutLoggingToFile added in v6.0.5

func (h *Handler) PutLoggingToFile(c *gin.Context)

func (*Handler) PutOpenAICompat

func (h *Handler) PutOpenAICompat(c *gin.Context)

func (*Handler) PutProxyURL

func (h *Handler) PutProxyURL(c *gin.Context)

func (*Handler) PutRequestLog

func (h *Handler) PutRequestLog(c *gin.Context)

func (*Handler) PutRequestRetry

func (h *Handler) PutRequestRetry(c *gin.Context)

func (*Handler) PutSwitchPreviewModel

func (h *Handler) PutSwitchPreviewModel(c *gin.Context)

func (*Handler) PutSwitchProject

func (h *Handler) PutSwitchProject(c *gin.Context)

func (*Handler) PutUsageStatisticsEnabled added in v6.0.5

func (h *Handler) PutUsageStatisticsEnabled(c *gin.Context)

func (*Handler) RequestAnthropicToken

func (h *Handler) RequestAnthropicToken(c *gin.Context)

func (*Handler) RequestCodexToken

func (h *Handler) RequestCodexToken(c *gin.Context)

func (*Handler) RequestGeminiCLIToken

func (h *Handler) RequestGeminiCLIToken(c *gin.Context)

func (*Handler) RequestIFlowToken added in v6.1.0

func (h *Handler) RequestIFlowToken(c *gin.Context)

func (*Handler) RequestQwenToken

func (h *Handler) RequestQwenToken(c *gin.Context)

func (*Handler) SetAuthManager

func (h *Handler) SetAuthManager(manager *coreauth.Manager)

SetAuthManager updates the auth manager reference used by management endpoints.

func (*Handler) SetConfig

func (h *Handler) SetConfig(cfg *config.Config)

SetConfig updates the in-memory config reference when the server hot-reloads.

func (*Handler) SetLocalPassword added in v6.0.1

func (h *Handler) SetLocalPassword(password string)

SetLocalPassword configures the runtime-local password accepted for localhost requests.

func (*Handler) SetLogDirectory added in v6.2.14

func (h *Handler) SetLogDirectory(dir string)

SetLogDirectory updates the directory where main.log should be looked up.

func (*Handler) SetUsageStatistics

func (h *Handler) SetUsageStatistics(stats *usage.RequestStatistics)

SetUsageStatistics allows replacing the usage statistics reference.

func (*Handler) UploadAuthFile

func (h *Handler) UploadAuthFile(c *gin.Context)

Upload auth file: multipart or raw JSON with ?name=

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL