config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package config loads application configuration from environment variables. All configuration is immutable after initialization (CFG-2).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// DBPath is the path to the SQLite database file.
	DBPath string

	// PeeringDBBaseURL is the base URL for the PeeringDB API.
	PeeringDBBaseURL string

	// SyncToken is the shared secret for on-demand sync trigger authentication.
	SyncToken string

	// SyncInterval is the duration between automatic sync runs.
	SyncInterval time.Duration

	// IncludeDeleted controls whether objects with status=deleted are synced.
	IncludeDeleted bool

	// ListenAddr is the address the HTTP server binds to.
	ListenAddr string

	// IsPrimary indicates whether this instance is the LiteFS primary node.
	IsPrimary bool

	// CORSOrigins is a comma-separated list of allowed CORS origins.
	// Configured via PDBPLUS_CORS_ORIGINS. Default is "*".
	CORSOrigins string

	// DrainTimeout is the graceful shutdown drain timeout.
	// Configured via PDBPLUS_DRAIN_TIMEOUT. Default is 10 seconds.
	DrainTimeout time.Duration

	// OTelSampleRate is the trace sampling ratio (0.0 to 1.0).
	// Configured via PDBPLUS_OTEL_SAMPLE_RATE. Default is 1.0 (always sample) per D-02.
	OTelSampleRate float64

	// SyncStaleThreshold is the maximum age of sync data before health reports degraded.
	// Configured via PDBPLUS_SYNC_STALE_THRESHOLD. Default is 24h per D-12.
	SyncStaleThreshold time.Duration
}

Config holds all application configuration. Immutable after Load returns.

func Load

func Load() (*Config, error)

Load reads configuration from environment variables, applies defaults, validates required fields, and returns an immutable Config. It fails fast on invalid configuration per CFG-1.

Jump to

Keyboard shortcuts

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