config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlogConfig

type BlogConfig struct {
	Path         string `yaml:"path"`
	PostsPerPage int    `yaml:"posts_per_page"`
}

BlogConfig contains blog-specific settings

type CacheConfig

type CacheConfig struct {
	MaxSizeMB  int64         `yaml:"max_size_mb"`
	TTLMinutes int           `yaml:"ttl_minutes"`
	TTL        time.Duration `yaml:"-"` // Computed from TTLMinutes
}

CacheConfig contains cache settings

type Config

type Config struct {
	Server ServerConfig `yaml:"server"`
	Cache  CacheConfig  `yaml:"cache"`
	Search SearchConfig `yaml:"search"`
	Blog   BlogConfig   `yaml:"blog"`
	Static StaticConfig `yaml:"static"`

	// Content is the path to markdown posts
	ContentFolder string `yaml:"content_folder"`

	// Logging
	Verbose bool `yaml:"verbose"`
}

Config represents the server configuration

func Default

func Default() *Config

Default returns a config with sensible defaults

func LoadFromFile

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

LoadFromFile loads configuration from a YAML file

func (*Config) Address

func (c *Config) Address() string

Address returns the full server address

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid

type SearchConfig

type SearchConfig struct {
	Enabled        bool   `yaml:"enabled"`
	IndexPath      string `yaml:"index_path"`
	RebuildOnStart bool   `yaml:"rebuild_on_start"`
}

SearchConfig contains search index settings

type ServerConfig

type ServerConfig struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

ServerConfig contains HTTP server settings

type StaticConfig

type StaticConfig struct {
	Enabled bool   `yaml:"enabled"`
	Folder  string `yaml:"folder"`
}

StaticConfig contains static file serving settings

Jump to

Keyboard shortcuts

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