config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.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 Config

type Config struct {
	Server  ServerConfig  `yaml:"server"`
	LLM     LLMConfig     `yaml:"llm"`
	Logging LoggingConfig `yaml:"logging"`
	Routes  []RouteConfig `yaml:"routes"`
}

Config represents the complete server configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a configuration with sensible defaults

func Load

func Load(r io.Reader) (*Config, error)

Load loads configuration from an io.Reader

func LoadFile

func LoadFile(filename string) (*Config, error)

LoadFile loads configuration from a YAML file

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid

type LLMConfig

type LLMConfig struct {
	Provider     string                 `yaml:"provider"`
	Model        string                 `yaml:"model"`
	APIKey       string                 `yaml:"api_key"`
	Endpoint     string                 `yaml:"endpoint"`
	SystemPrompt string                 `yaml:"system_prompt"`
	Options      map[string]interface{} `yaml:"options"`
}

LLMConfig holds LLM-specific configuration

type LoggingConfig

type LoggingConfig struct {
	Level  string `yaml:"level"`
	Format string `yaml:"format"`
}

LoggingConfig holds logging-specific configuration

type RouteConfig

type RouteConfig struct {
	Path    string `yaml:"path"`
	Handler string `yaml:"handler"`
}

RouteConfig holds route-specific configuration

type ServerConfig

type ServerConfig struct {
	Port            int           `yaml:"port"`
	ReadTimeout     time.Duration `yaml:"read_timeout"`
	WriteTimeout    time.Duration `yaml:"write_timeout"`
	MaxHeaderBytes  int           `yaml:"max_header_bytes"`
	ShutdownTimeout time.Duration `yaml:"shutdown_timeout"`
}

ServerConfig holds server-specific configuration

Jump to

Keyboard shortcuts

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