Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Port int `toml:"port"`
Host string `toml:"host"`
Data string `toml:"data"`
BaseURL string `toml:"base_url"`
CORSOrigins []string `toml:"cors_origins"`
TrustProxy bool `toml:"trust_proxy"`
Tunnel bool `toml:"tunnel"`
LogFormat string `toml:"log_format"` // "json" or "text" (default: "text")
TLSCert string `toml:"tls_cert"`
TLSKey string `toml:"tls_key"`
AdminToken string `toml:"admin_token"`
MaxSecretSize int `toml:"max_secret_size"` // bytes; 0 = default (512000)
Metrics bool `toml:"metrics"`
}
Config holds all resolved configuration values.
func LoadEnv ¶
LoadEnv reads ZKETTLE_* environment variables and returns a Config with only the fields that were set via env vars. Returns a Config and a set of field names that were explicitly set.
func LoadFile ¶
LoadFile attempts to load a TOML config file from standard locations. Search order: ./zkettle.toml, $HOME/.config/zkettle/zkettle.toml Returns the loaded config, the path that was loaded (empty if none found), a set of field names explicitly defined in the file, and any error. Returns an error only if a file exists but is malformed.
func Merge ¶
func Merge(defaults, file Config, fileSet map[string]bool, env Config, envSet map[string]bool, flags Config, flagSet map[string]bool) Config
Merge combines defaults, file config, env config, and flag overrides. Precedence: flags > env > file > defaults. All set maps use underscore-format keys (e.g. "base_url", "trust_proxy").
func ResolveAll ¶
ResolveAll loads config from file and env, merges with flags and defaults, validates, and checks mutual exclusivity constraints. Returns the resolved config and the config file path (empty if none found).