config

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Port ranges
	MinPort = 1
	MaxPort = 65535

	// Default values (using shared constants)
	DefaultServerPort   = constants.DefaultServerPort
	DefaultMySQLPort    = constants.DefaultDatabasePort
	DefaultPostgresPort = constants.DefaultPostgresPort

	// Database types
	DatabaseMySQL    = "mysql"
	DatabasePostgres = "postgres"
	DatabaseSQLite   = "sqlite"
)

Constants for validation

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string `yaml:"allowed_origins" json:"allowed_origins"`
}

type Config

type Config struct {
	Database      DatabaseConfig `yaml:"database" json:"database"`
	Server        ServerConfig   `yaml:"server" json:"server"`
	LycheeBaseURL string         `yaml:"lychee_base_url" json:"lychee_base_url"`
	Ollama        OllamaConfig   `yaml:"ollama" json:"ollama"`
	OpenAI        OpenAIConfig   `yaml:"openai" json:"openai"`
}

func Load

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

func (*Config) GetDSN

func (c *Config) GetDSN() string

GetDSN returns the database connection string for the configured database

func (*Config) IsOllamaEnabled

func (c *Config) IsOllamaEnabled() bool

IsOllamaEnabled returns true if Ollama configuration is provided and valid

func (*Config) IsOpenAIEnabled added in v1.1.0

func (c *Config) IsOpenAIEnabled() bool

IsOpenAIEnabled returns true if OpenAI configuration is provided and valid

type DatabaseConfig

type DatabaseConfig struct {
	Type     string `yaml:"type" json:"type"`
	Host     string `yaml:"host" json:"host"`
	Port     int    `yaml:"port" json:"port"`
	User     string `yaml:"user" json:"user"`
	Password string `yaml:"password" json:"password"`
	Database string `yaml:"database" json:"database"`
	Path     string `yaml:"path" json:"path"` // For SQLite
}

type OllamaConfig

type OllamaConfig struct {
	URL   string `yaml:"url" json:"url"`
	Model string `yaml:"model" json:"model"`
}

type OpenAIConfig added in v1.1.0

type OpenAIConfig struct {
	URL    string `yaml:"url" json:"url"`
	APIKey string `yaml:"api_key" json:"api_key"`
	Model  string `yaml:"model" json:"model"`
}

type ServerConfig

type ServerConfig struct {
	Port int        `yaml:"port" json:"port"`
	CORS CORSConfig `yaml:"cors" json:"cors"`
}

Jump to

Keyboard shortcuts

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