types

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIConfig

type AIConfig struct {
	// Enable AI features
	Enabled bool `yaml:"enabled" json:"enabled"`

	// OpenRouter API key (can also be set via AI_OPENROUTER_KEY env var)
	OpenRouterKey string `yaml:"openRouterKey" json:"openRouterKey"`

	// Default model to use (default: "anthropic/claude-sonnet-4")
	DefaultModel string `yaml:"defaultModel" json:"defaultModel"`

	// Allowed models (empty means all models allowed)
	AllowedModels []string `yaml:"allowedModels" json:"allowedModels"`

	// Max tokens per response (default: 8192)
	MaxTokens int `yaml:"maxTokens" json:"maxTokens"`
}

AIConfig holds configuration for the AI assistant feature.

func DefaultAIConfig

func DefaultAIConfig() *AIConfig

DefaultAIConfig returns sensible defaults for AI configuration.

func (*AIConfig) ApplyEnvironment

func (c *AIConfig) ApplyEnvironment()

ApplyEnvironment applies environment variables to AIConfig. Environment variables override config file values.

func (*AIConfig) Validate

func (c *AIConfig) Validate() error

Validate validates the AI configuration.

type APIConfig

type APIConfig struct {
	Enabled bool `yaml:"enabled" envconfig:"WEB_API_ENABLED"`
}

type FrontendConfig

type FrontendConfig struct {
	Enabled  bool   `yaml:"enabled" envconfig:"WEB_FRONTEND_ENABLED"`
	Debug    bool   `yaml:"debug" envconfig:"WEB_FRONTEND_DEBUG"`
	Pprof    bool   `yaml:"pprof" envconfig:"WEB_FRONTEND_PPROF"`
	Minify   bool   `yaml:"minify" envconfig:"WEB_FRONTEND_MINIFY"`
	SiteName string `yaml:"siteName" envconfig:"WEB_FRONTEND_SITE_NAME"`
}

type ServerConfig

type ServerConfig struct {
	Port string `yaml:"port" envconfig:"WEB_SERVER_PORT"`
	Host string `yaml:"host" envconfig:"WEB_SERVER_HOST"`

	ReadTimeout  time.Duration `yaml:"readTimeout" envconfig:"WEB_SERVER_READ_TIMEOUT"`
	WriteTimeout time.Duration `yaml:"writeTimeout" envconfig:"WEB_SERVER_WRITE_TIMEOUT"`
	IdleTimeout  time.Duration `yaml:"idleTimeout" envconfig:"WEB_SERVER_IDLE_TIMEOUT"`
}

type WebConfig

type WebConfig struct {
	Server   *ServerConfig   `yaml:"server"`
	Frontend *FrontendConfig `yaml:"frontend"`
	API      *APIConfig      `yaml:"api"`

	// AuthProviderURL is the canonical URL of a remote authenticatoor
	// service. When set, API requests must carry a JWT verified against
	// the service's JWKS, and the SPA loads <url>/client.js to drive
	// login/logout. When empty, the API is unauthenticated.
	AuthProviderURL string `yaml:"authProviderUrl" envconfig:"WEB_AUTH_PROVIDER_URL"`

	// AuthProviderAudience overrides the expected JWT "aud" claim. When
	// empty, it is derived from AuthProviderURL as the parent DNS zone of
	// its host (e.g. "https://auth.foo.example" → "foo.example"). Set this
	// explicitly when the issuer URL has no meaningful parent zone (e.g.
	// when pointing at a raw IP like "http://127.0.0.1:18080" during local
	// development).
	AuthProviderAudience string `yaml:"authProviderAudience" envconfig:"WEB_AUTH_PROVIDER_AUDIENCE"`
}

Jump to

Keyboard shortcuts

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