Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureAPIKey ¶ added in v0.4.0
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):
- 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.
- config_entries row at (namespace="auth", key="api_key"). Loaded and assigned.
- Generate a new key, INSERT it into config_entries, use it.
Returns (generated=true) if a fresh key was created.
func WriteDefault ¶
WriteDefault writes a default config file to the given path.
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"`
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).
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"`
}
FlareSolverrConfig holds optional FlareSolverr proxy settings. When URL is set, Pulse will use FlareSolverr to bypass Cloudflare challenges on protected indexer sites.
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.