cmd

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cmd provides command-line argument parsing and configuration management functionality. Supports loading configuration from command-line arguments, environment variables and configuration files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(cfg *Config) error

ValidateConfig validates configuration validity

Types

type Config

type Config struct {
	Port                     string   // 16 bytes
	Redis                    string   // 16 bytes
	RedisPassword            string   // 16 bytes
	RedisEnabled             bool     // 1 byte (padding to 8 bytes)
	RemoteConfig             string   // 16 bytes
	RemoteKey                string   // 16 bytes
	Mode                     string   // 16 bytes (merge mode; legacy MODE is a deprecated alias)
	Environment              string   // env ENVIRONMENT: development|test|production (security policy)
	LegacyModeUsedForEnv     bool     // true when legacy MODE was used to derive the environment (deprecation)
	APIKey                   string   // 16 bytes
	DataFile                 string   // 16 bytes - local user data file path
	DataDir                  string   // 16 bytes - local user data directory (merge *.json)
	ResponseFields           []string // API response field whitelist (empty = all)
	RemoteDecryptEnabled     bool     // decrypt remote API response with RSA
	RemoteRSAPrivateKeyFile  string   // path to PEM file for RSA decryption (preferred)
	RemoteRSAPrivateKey      string   // inline PEM for RSA decryption (used when file not set)
	RemoteEncryptionRequired bool     // env REMOTE_ENCRYPTION_REQUIRED: fail closed on plaintext
	RemoteEncryptionFormat   string   // env REMOTE_ENCRYPTION_FORMAT: auto|v2|legacy
	UserIDStrategy           string   // env USER_ID_STRATEGY: legacy|sha256-128 (default legacy)
	RequireExplicitUserID    bool     // env REQUIRE_EXPLICIT_USER_ID: reject records without user_id
	TaskInterval             int      // 8 bytes
	HTTPTimeout              int      // 8 bytes
	HTTPMaxIdleConns         int      // 8 bytes
	HTTPInsecureTLS          bool     // 1 byte (padding to 8 bytes)
	HMACKeys                 string   // JSON map key_id -> secret (env WARDEN_HMAC_KEYS)
	HMACToleranceSec         int      // env WARDEN_HMAC_TIMESTAMP_TOLERANCE, default 60
	TLSCertFile              string   // env WARDEN_TLS_CERT
	TLSKeyFile               string   // env WARDEN_TLS_KEY
	TLSCAFile                string   // env WARDEN_TLS_CA (client CA for mTLS)
	TLSRequireClientCert     bool     // env WARDEN_TLS_REQUIRE_CLIENT_CERT
}

Config stores application configuration

func GetArgs

func GetArgs() *Config

GetArgs parses command-line arguments and environment variables, returns configuration struct Priority: command-line arguments > environment variables > configuration file > default values If -config-file parameter is provided, will attempt to load from configuration file

func LoadConfig

func LoadConfig(configFile string) (*Config, error)

LoadConfig loads configuration (new interface, supports configuration file) Priority: command-line arguments > environment variables > configuration file > default values

Jump to

Keyboard shortcuts

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