config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminEncryptionKey added in v1.2.0

func AdminEncryptionKey(admin AdminConfig) ([]byte, error)

func HeaderMap

func HeaderMap(headers map[string]string) http.Header

Types

type AdminConfig added in v1.2.0

type AdminConfig struct {
	Enabled          bool   `yaml:"enabled"`
	Listen           string `yaml:"listen"`
	DatabasePath     string `yaml:"database_path"`
	EncryptionKeyEnv string `yaml:"encryption_key_env"`
}

type AuthConfig

type AuthConfig struct {
	Issuer string `yaml:"issuer"`
}

type BackendConfig

type BackendConfig struct {
	ID                string            `yaml:"id"`
	URL               string            `yaml:"url"`
	Required          bool              `yaml:"required"`
	RequiredScopes    []string          `yaml:"required_scopes"`
	ToolRules         []ToolRule        `yaml:"tool_rules"`
	RequestTimeout    Duration          `yaml:"request_timeout"`
	AllowInsecureHTTP bool              `yaml:"allow_insecure_http"`
	Headers           map[string]string `yaml:"headers"`
	OAuth             *OAuthConfig      `yaml:"oauth"`
}

func (BackendConfig) RequiredToolScopes added in v1.1.0

func (backend BackendConfig) RequiredToolScopes(toolName string) []string

type Config

type Config struct {
	Server   ServerConfig    `yaml:"server"`
	Auth     AuthConfig      `yaml:"auth"`
	Admin    AdminConfig     `yaml:"admin"`
	Backends []BackendConfig `yaml:"backends"`
}

func Load

func Load(path string) (*Config, error)

func LoadStatic added in v1.2.0

func LoadStatic(path string) (*Config, error)

LoadStatic loads server, auth, and admin configuration without expanding or validating YAML backends when the SQLite-backed admin platform is enabled. This lets an initialized database remain the sole backend source even after bootstrap-only environment variables have been removed.

func (*Config) AllScopes

func (cfg *Config) AllScopes() []string

func (*Config) Backend

func (cfg *Config) Backend(id string) (BackendConfig, bool)

func (*Config) ImmutableEqual

func (cfg *Config) ImmutableEqual(other *Config) error

func (*Config) MCPPath

func (cfg *Config) MCPPath() string

func (*Config) ResourceMetadataPath

func (cfg *Config) ResourceMetadataPath() string

func (*Config) ResourceMetadataURL

func (cfg *Config) ResourceMetadataURL() string

func (*Config) Validate

func (cfg *Config) Validate() error

type Duration

type Duration struct {
	time.Duration
}

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(node *yaml.Node) error

type OAuthConfig

type OAuthConfig struct {
	Type         string   `yaml:"type"`
	Issuer       string   `yaml:"issuer"`
	ClientID     string   `yaml:"client_id"`
	ClientSecret string   `yaml:"client_secret"`
	Scopes       []string `yaml:"scopes"`
}

type ServerConfig

type ServerConfig struct {
	Listen              string   `yaml:"listen"`
	PublicURL           string   `yaml:"public_url"`
	PageSize            int      `yaml:"page_size"`
	RequestTimeout      Duration `yaml:"request_timeout"`
	DrainTimeout        Duration `yaml:"drain_timeout"`
	RefreshInterval     Duration `yaml:"refresh_interval"`
	CatalogTTL          Duration `yaml:"catalog_ttl"`
	MaxRequestBodyBytes int64    `yaml:"max_request_body_bytes"`
	AllowedOrigins      []string `yaml:"allowed_origins"`
}

type ToolRule added in v1.1.0

type ToolRule struct {
	Match          string   `yaml:"match" json:"match"`
	RequiredScopes []string `yaml:"required_scopes" json:"required_scopes"`
}

func (ToolRule) Matches added in v1.1.0

func (rule ToolRule) Matches(toolName string) bool

Jump to

Keyboard shortcuts

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