Documentation
¶
Overview ¶
Package config loads and validates the hookkeep YAML configuration.
Secrets never live in the file itself: the config only names the environment variables that hold them (dsn_env, secret_env, ui_token_env).
Index ¶
Constants ¶
const ( DefaultListen = ":8080" DefaultMaxBody = 1 << 20 // 1 MiB DefaultMaxAttempts = 10 DefaultBackoffBase = 5 * time.Second DefaultBackoffMax = 15 * time.Minute DefaultRetention = 30 * 24 * time.Hour DefaultTimeout = 10 * time.Second )
Defaults applied by Load when a field is left unset.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backoff ¶
type Backoff struct {
Base Duration `yaml:"base"`
Max Duration `yaml:"max"`
Jitter *bool `yaml:"jitter"`
}
func (Backoff) JitterEnabled ¶
JitterEnabled reports whether backoff jitter is on (default true).
type Config ¶
type Config struct {
Version int `yaml:"version"`
Database Database `yaml:"database"`
Server Server `yaml:"server"`
Sources []Source `yaml:"sources"`
Targets []Target `yaml:"targets"`
Retry Retry `yaml:"retry"`
Retention Duration `yaml:"retention"`
}
func Load ¶
Load reads, parses and validates the config file at path. Unknown YAML fields are an error so typos never silently disable behavior.
func (*Config) SourceByName ¶
SourceByName returns the source config, or nil if not declared.
func (*Config) TargetByName ¶
TargetByName returns the target config, or nil if not declared.
type Duration ¶
Duration is a time.Duration that unmarshals from YAML strings like "30s", "15m" or "30d" (days are not part of time.ParseDuration but are the natural unit for retention).
type Size ¶
type Size int64
Size is a byte count that unmarshals from YAML strings like "1MiB", "512KiB" or a plain number of bytes.
type Verify ¶
type Verify struct {
Preset string `yaml:"preset"`
SecretEnv string `yaml:"secret_env"`
Header string `yaml:"header"`
Encoding string `yaml:"encoding"`
Prefix string `yaml:"prefix"`
MerchantIDEnv string `yaml:"merchant_id_env"`
}
Verify configures signature verification for a source. Preset selects the scheme; header/encoding/prefix are only used by the generic-hmac preset, merchant_id_env only by iyzico (subscription events sign the merchant id, which is not present in the payload).