Documentation
¶
Overview ¶
Package config loads runtime configuration from flags and environment variables and resolves sensible cross-platform defaults.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Addr is the listen address. Defaults to loopback only; binding to a
// public interface is an explicit, conscious choice by the operator.
Addr string
// DataDir holds the SQLite database and any persisted secrets.
DataDir string
// SessionTTL is how long a logged-in session token stays valid.
SessionTTL time.Duration
// Dev enables developer conveniences (e.g. permissive CORS for Vite).
Dev bool
// UpdateCheck enables the periodic GitHub-release update check that backs
// the admin "update available" banner. On by default; set DC_UPDATE_CHECK=0
// (or -update-check=false) to disable outbound calls on air-gapped hosts.
UpdateCheck bool
// MetricsToken, when set, requires a bearer token to scrape /metrics.
// Empty means the endpoint is open (fine for loopback-only use).
MetricsToken string
// TLSCert/TLSKey are paths to a PEM certificate and key. When both are set,
// the server speaks HTTPS directly (otherwise plain HTTP behind a proxy).
TLSCert string
TLSKey string
// Version is the build version string, set by main (not from flags/env).
Version string
// ConfigFile is the config file that was loaded, or "" if none.
ConfigFile string
// Metrics history backend. RedisAddr empty → in-memory ring buffer.
RedisAddr string
RedisPassword string
RedisDB int
MetricsRetention time.Duration
}
Config holds all runtime options.
func Load ¶
Load parses flags/env/config-file and returns the resolved configuration.
Precedence (highest first): command-line flag → environment variable → config file → built-in default. The config file is a simple "KEY=VALUE" file using the same DC_* keys as the environment. Its path comes from -config, then $DC_CONFIG, then the platform default (/etc/docker-commander/ commander.conf on Unix, %ProgramData%\docker-commander\commander.conf on Windows); a missing default file is ignored, a missing explicit one errors.