config

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveConfigPath added in v0.24.2

func ResolveConfigPath(explicitPath string) string

ResolveConfigPath resolves the config file path from various sources. Priority: explicit path > HOTPLEX_SERVER_CONFIG env > ./configs/server.yaml

Types

type EngineConfig added in v0.24.2

type EngineConfig struct {
	Timeout         time.Duration `yaml:"timeout"`
	IdleTimeout     time.Duration `yaml:"idle_timeout"`
	WorkDir         string        `yaml:"work_dir"`
	SystemPrompt    string        `yaml:"system_prompt"`
	AllowedTools    []string      `yaml:"allowed_tools"`
	DisallowedTools []string      `yaml:"disallowed_tools"`
}

EngineConfig contains engine-level configuration.

type SecurityConfig added in v0.24.2

type SecurityConfig struct {
	APIKey         string `yaml:"api_key"`
	PermissionMode string `yaml:"permission_mode"`
}

SecurityConfig contains security settings.

type ServerConfig added in v0.24.2

type ServerConfig struct {
	Engine   EngineConfig   `yaml:"engine"`
	Server   ServerSettings `yaml:"server"`
	Security SecurityConfig `yaml:"security"`
}

ServerConfig represents the YAML configuration for the hotplexd server.

type ServerLoader added in v0.24.2

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

ServerLoader loads and manages server configuration from YAML files.

func NewServerLoader added in v0.24.2

func NewServerLoader(configPath string, logger *slog.Logger) (*ServerLoader, error)

NewServerLoader creates a new server configuration loader.

func (*ServerLoader) Get added in v0.24.2

func (l *ServerLoader) Get() *ServerConfig

Get returns the current server configuration.

func (*ServerLoader) GetIdleTimeout added in v0.24.2

func (l *ServerLoader) GetIdleTimeout() time.Duration

GetIdleTimeout returns the idle timeout.

func (*ServerLoader) GetPort added in v0.24.2

func (l *ServerLoader) GetPort() string

GetPort returns the server port.

func (*ServerLoader) GetSystemPrompt added in v0.24.2

func (l *ServerLoader) GetSystemPrompt() string

GetSystemPrompt returns the base system prompt.

func (*ServerLoader) GetTimeout added in v0.24.2

func (l *ServerLoader) GetTimeout() time.Duration

GetTimeout returns the engine timeout.

func (*ServerLoader) GetWorkDir added in v0.24.2

func (l *ServerLoader) GetWorkDir() string

GetWorkDir returns the working directory.

func (*ServerLoader) Load added in v0.24.2

func (l *ServerLoader) Load() error

Load loads the server configuration from the YAML file.

type ServerSettings added in v0.24.2

type ServerSettings struct {
	Port      string `yaml:"port"`
	LogLevel  string `yaml:"log_level"`
	LogFormat string `yaml:"log_format"`
}

ServerSettings contains server-level settings.

type YAMLHotReloader

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

YAMLHotReloader is a hot reload implementation for YAML configuration files. It watches for file changes and automatically reloads the configuration.

func NewYAMLHotReloader

func NewYAMLHotReloader(path string, initialConfig any, logger *slog.Logger) (*YAMLHotReloader, error)

NewYAMLHotReloader creates a new YAML hot reloader. The initialConfig must be a pointer to a struct that will be unmarshaled from YAML.

func (*YAMLHotReloader) Close

func (h *YAMLHotReloader) Close() error

Close stops the file watcher and releases resources.

func (*YAMLHotReloader) Get

func (h *YAMLHotReloader) Get() any

Get returns the current configuration.

func (*YAMLHotReloader) OnReload

func (h *YAMLHotReloader) OnReload(fn func(any))

OnReload sets the callback function that will be called when the config is reloaded.

func (*YAMLHotReloader) Start

func (h *YAMLHotReloader) Start(ctx context.Context) error

Start begins watching the configuration file for changes. It is idempotent - calling Start multiple times has no additional effect.

Jump to

Keyboard shortcuts

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