config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultConfigFile = "doctrove.yaml"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Settings *Settings              `yaml:"settings,omitempty"`
	Sites    map[string]*SiteConfig `yaml:"sites"`
	// contains filtered or unexported fields
}

func Load

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

Load reads the config from the given root directory. If the file doesn't exist, returns an empty config with default settings.

func (*Config) AddSite

func (c *Config) AddSite(domain, url string) error

AddSite adds a new site to the config. Returns an error if it already exists.

func (*Config) RemoveSite

func (c *Config) RemoveSite(domain string) error

RemoveSite removes a site from the config.

func (*Config) Save

func (c *Config) Save() error

Save writes the config back to disk.

func (*Config) SetContentTypes

func (c *Config) SetContentTypes(domain, contentTypes string)

SetContentTypes updates the content_types filter for a site, allowing agents to widen or narrow the filter after initial scan.

func (*Config) UpdateLastSync

func (c *Config) UpdateLastSync(domain string, t time.Time)

UpdateLastSync records the sync time for a site.

type Settings

type Settings struct {
	RateLimit      int    `yaml:"rate_limit,omitempty"` // requests/sec per host
	RateBurst      int    `yaml:"rate_burst,omitempty"` // burst capacity
	Timeout        string `yaml:"timeout,omitempty"`    // HTTP timeout (e.g. "30s")
	MaxProbes      int    `yaml:"max_probes,omitempty"` // companion probes per llms.txt
	UserAgent      string `yaml:"user_agent,omitempty"` // User-Agent header
	EventsURL      string `yaml:"events_url,omitempty"` // URL for postDash (e.g. http://localhost:6060/events)
	Context7APIKey string `yaml:"context7_api_key"`     // Context7 API key (get one at https://context7.com)
}

func DefaultSettings

func DefaultSettings() *Settings

DefaultSettings returns settings with sane defaults.

func (*Settings) HasContext7Key

func (s *Settings) HasContext7Key() bool

HasContext7Key returns true if a valid Context7 API key is configured. Keys must start with the "ctx7sk" prefix to be considered valid.

func (*Settings) TimeoutDuration

func (s *Settings) TimeoutDuration() time.Duration

TimeoutDuration parses the Timeout string as a time.Duration.

type SiteConfig

type SiteConfig struct {
	URL          string    `yaml:"url"`
	Include      []string  `yaml:"include,omitempty"`
	Exclude      []string  `yaml:"exclude,omitempty"`
	ContentTypes string    `yaml:"content_types,omitempty"` // persisted from scan (e.g. "llms-txt,llms-full-txt")
	UpdateFreq   string    `yaml:"update_freq,omitempty"`
	LastSync     time.Time `yaml:"last_sync,omitempty"`
}

Jump to

Keyboard shortcuts

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