config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 9 Imported by: 0 modules, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureAPIKey added in v0.4.0

func EnsureAPIKey(ctx context.Context, store APIKeyStore, cfg *Config) (generated bool, err error)

EnsureAPIKey makes sure cfg.Auth.APIKey is set, persisting it in the shared config_entries table so it survives container restarts. Called from main after the DB is open and the config store is available.

Priority (first match wins):

  1. cfg.Auth.APIKey already set — from PULSE_AUTH_API_KEY env var or a loaded config.yaml. Treated as an ops override; not written to DB.
  2. config_entries row at (namespace="auth", key="api_key"). Loaded and assigned.
  3. Generate a new key, INSERT it into config_entries, use it.

Returns (generated=true) if a fresh key was created.

Types

type APIKeyStore added in v0.4.0

type APIKeyStore interface {
	GetAPIKey(ctx context.Context) (string, error)
	SetAPIKey(ctx context.Context, value string) error
}

APIKeyStore is the narrow interface EnsureAPIKey needs from the shared config store. Wired up in main.go by the cfgstore.Store implementation.

type AuthConfig

type AuthConfig struct {
	APIKey Secret `mapstructure:"api_key"`

	// APIKeyFile is a path to a file containing the API key, typically a
	// Docker secret mounted at /run/secrets/*. When non-empty, its contents
	// replace APIKey at load time and win over the DB config_entries row.
	APIKeyFile string `mapstructure:"api_key_file"`
}

AuthConfig holds the Pulse API key used to authenticate requests.

type Config

type Config struct {
	Server       ServerConfig       `mapstructure:"server"`
	Database     DatabaseConfig     `mapstructure:"database"`
	Log          LogConfig          `mapstructure:"log"`
	Auth         AuthConfig         `mapstructure:"auth"`
	FlareSolverr FlareSolverrConfig `mapstructure:"flaresolverr"`
	Scraper      ScraperConfig      `mapstructure:"scraper"`
	Dashboard    DashboardConfig    `mapstructure:"dashboard"`

	// ConfigFile is the path of the config file that was loaded, if any.
	ConfigFile string `mapstructure:"-"`
}

Config holds all application configuration. Values are loaded from config.yaml and can be overridden by PULSE_* environment variables (e.g. PULSE_SERVER_PORT=9696).

func Load

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

Load reads configuration from file, env, and flags, then returns a Config.

type DashboardConfig added in v0.4.0

type DashboardConfig struct {
	// DockerSocket is the path to a mounted Docker socket. Empty disables
	// container stats entirely. The socket is read-only on disk but still
	// effectively grants root on most Docker builds — opt in only.
	DockerSocket string `mapstructure:"docker_socket"`

	// GluetunURL is the base URL of a Gluetun container's control server
	// (e.g. "http://vpn:8000"). Empty disables the VPN panel.
	GluetunURL string `mapstructure:"gluetun_url"`

	// GluetunAPIKey is sent as X-API-Key to Gluetun's control server. The
	// routes that change the VPN region (/v1/vpn/settings) can read the
	// VPN credentials, so they belong behind a Gluetun role with apikey
	// auth rather than auth = "none".
	GluetunAPIKey string `mapstructure:"gluetun_api_key"`

	// GluetunServersDir is Gluetun's servers directory (/gluetun/servers)
	// mounted read-only, for the list of regions. With GluetunAPIKey it
	// enables changing the VPN region from the dashboard.
	GluetunServersDir string `mapstructure:"gluetun_servers_dir"`

	// GluetunContainer is the docker container name for Gluetun. Defaults
	// to "vpn" when unset, matching deploy/docker-compose.vpn.yml.
	GluetunContainer string `mapstructure:"gluetun_container"`

	// ContainerNames overrides the default service-name → container-name
	// mapping for non-standard deployments (e.g. Haul → haul-prod).
	ContainerNames map[string]string `mapstructure:"container_names"`
}

DashboardConfig opts the dashboard into Docker-stats and Gluetun integrations. Both default off — the dashboard works without them, just without container resource info or VPN status panels.

type DatabaseConfig

type DatabaseConfig struct {
	// Path is the SQLite database file location.
	Path string `mapstructure:"path"`
}

DatabaseConfig configures the SQLite database.

type FlareSolverrConfig

type FlareSolverrConfig struct {
	// URL is the FlareSolverr endpoint (e.g., "http://localhost:8191").
	// Empty means disabled.
	URL string `mapstructure:"url"`
}

type LogConfig

type LogConfig struct {
	Level  string `mapstructure:"level"`
	Format string `mapstructure:"format"`
}

LogConfig controls log output format and verbosity.

type ScraperConfig added in v0.5.0

type ScraperConfig struct {
	// ProxyURL routes every request to an indexer site (searches, .torrent
	// downloads, connection tests) through this HTTP proxy, e.g. a Gluetun
	// container's "http://vpn:8888". There is no fallback: if the proxy is
	// down, site requests fail rather than leave from the host's own IP.
	// Local addresses always connect directly. Empty means direct.
	ProxyURL string `mapstructure:"proxy_url"`
}

FlareSolverrConfig holds optional FlareSolverr proxy settings. When URL is set, Pulse will use FlareSolverr to bypass Cloudflare challenges on protected indexer sites. ScraperConfig controls how Pulse reaches indexer sites.

type Secret

type Secret string

Secret is a string value that is redacted when printed.

func (Secret) String

func (s Secret) String() string

String redacts the value.

func (Secret) Value

func (s Secret) Value() string

Value returns the underlying string.

type ServerConfig

type ServerConfig struct {
	Host        string `mapstructure:"host"`
	Port        int    `mapstructure:"port"`
	ExternalURL string `mapstructure:"external_url"` // e.g., "http://pulse:9696" — for Torznab proxy URLs
}

ServerConfig controls the HTTP server.

Jump to

Keyboard shortcuts

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