config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads refetch's settings: defaults, then ~/.config/refetch/config.toml, then REFETCH_* environment variables, so the plugin's hooks, its MCP server and the CLI read the same switches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataDir

func DataDir() string

DataDir holds events.db and saved pages: REFETCH_DATA, else $XDG_DATA_HOME/refetch, else ~/.local/share/refetch.

func Path

func Path() string

Path is the config file: REFETCH_CONFIG, else $XDG_CONFIG_HOME/refetch/config.toml, else ~/.config/refetch/config.toml.

Types

type Config

type Config struct {
	Impersonate   string   `toml:"impersonate"`    // always, fallback or off
	Render        string   `toml:"render"`         // auto or off (headless Chrome step)
	RenderTimeout Duration `toml:"render_timeout"` // hard cap for the headless Chrome step
	Timeout       Duration `toml:"timeout"`        // per HTTP client
	RespectRobots bool     `toml:"respect_robots"` // consult robots.txt
	Stats         bool     `toml:"stats"`          // record events.db rows
	Mode          string   `toml:"mode"`           // nudge or inline (hook response)
	UserAgent     string   `toml:"user_agent"`     // the plain client's User-Agent; empty = refetch/<version>
}

Config holds every switch. The zero value is not valid; use Default or Load.

func Default

func Default() Config

Default is the configuration with nothing set: everything on, robots off.

func Load

func Load() (Config, error)

Load reads the config file if it exists, applies REFETCH_* overrides and validates the result.

func (Config) Validate

func (c Config) Validate() error

Validate checks the enumerated settings and durations.

type Duration

type Duration struct{ time.Duration }

Duration is a time.Duration written as "10s" in TOML and env vars.

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

MarshalText writes the duration as a Go duration string.

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(b []byte) error

UnmarshalText parses a Go duration string.

Jump to

Keyboard shortcuts

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