config

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentBackendConfig

type AgentBackendConfig struct {
	Allowed          bool                       `yaml:"allowed"`
	ToolDenylist     []string                   `yaml:"tool_denylist"`
	RateLimits       map[string]RateLimitConfig `yaml:"rate_limits"`
	ApprovalRequired []string                   `yaml:"approval_required"`
}

AgentBackendConfig defines an agent's access to a specific backend.

type AgentConfig

type AgentConfig struct {
	DisplayName string                        `yaml:"display_name"`
	Backends    map[string]AgentBackendConfig `yaml:"backends"`
}

AgentConfig defines per-agent access rules.

type ApprovalConfig

type ApprovalConfig struct {
	Feishu          FeishuConfig         `yaml:"feishu"`
	Generic         GenericWebhookConfig `yaml:"generic"`
	Timeout         time.Duration        `yaml:"timeout"`
	CallbackBaseURL string               `yaml:"callback_base_url"`
}

ApprovalConfig holds approval system settings.

type AuditConfig

type AuditConfig struct {
	DBPath        string `yaml:"db_path"`
	RetentionDays int    `yaml:"retention_days"`
}

AuditConfig holds audit logging settings.

type BackendConfig

type BackendConfig struct {
	URL       string        `yaml:"url"`
	HealthURL string        `yaml:"health_url"`
	Timeout   time.Duration `yaml:"timeout"`
}

BackendConfig defines an upstream MCP server.

type Config

type Config struct {
	Server   ServerConfig             `yaml:"server"`
	Backends map[string]BackendConfig `yaml:"backends"`
	Queue    map[string]QueueConfig   `yaml:"queue"`
	Agents   map[string]AgentConfig   `yaml:"agents"`
	Approval ApprovalConfig           `yaml:"approval"`
	Audit    AuditConfig              `yaml:"audit"`
}

Config is the root configuration structure.

type FeishuConfig

type FeishuConfig struct {
	WebhookURL string `yaml:"webhook_url"`
}

FeishuConfig holds Feishu webhook settings.

type GenericWebhookConfig added in v0.1.4

type GenericWebhookConfig struct {
	WebhookURL string `yaml:"webhook_url"`
}

GenericWebhookConfig holds generic webhook settings.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles configuration loading and provides thread-safe access.

func NewManager

func NewManager(path string) (*Manager, error)

NewManager creates a Manager and loads the config from the given path.

func NewManagerFromConfig added in v0.1.6

func NewManagerFromConfig(cfg *Config) *Manager

NewManagerFromConfig creates a Manager from a Config struct directly. Useful for tests and programmatic configuration (e.g., demo mode).

func (*Manager) Get

func (m *Manager) Get() *Config

Get returns the current config (read-safe).

func (*Manager) Reload

func (m *Manager) Reload() error

Reload re-reads the config file. Returns an error if the new config is invalid.

type QueueConfig

type QueueConfig struct {
	Enabled          bool                       `yaml:"enabled"`
	DelayMin         time.Duration              `yaml:"delay_min"`
	DelayMax         time.Duration              `yaml:"delay_max"`
	MaxPending       int                        `yaml:"max_pending"`
	BypassTools      []string                   `yaml:"bypass_tools"`
	GlobalRateLimits map[string]RateLimitConfig `yaml:"global_rate_limits"`
}

QueueConfig defines FIFO queue settings per backend.

type RateLimitConfig

type RateLimitConfig struct {
	Window   time.Duration `yaml:"window"`
	MaxCount int           `yaml:"max_count"`
}

RateLimitConfig defines a sliding window rate limit.

type ServerConfig

type ServerConfig struct {
	Listen       string        `yaml:"listen"`
	ReadTimeout  time.Duration `yaml:"read_timeout"`
	WriteTimeout time.Duration `yaml:"write_timeout"`
	APIToken     string        `yaml:"api_token"`
}

ServerConfig holds HTTP server settings.

Jump to

Keyboard shortcuts

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