123456789101112131415161718192021222324252627282930313233 |
- package webhook
- import "time"
- // Config represents the configuration for a webhook client
- type Config struct {
- // BaseURL is the base URL for the webhook endpoint
- BaseURL string `json:"base_url" validate:"required,url"`
- // Domain identifies the source domain sending webhooks
- Domain string `json:"domain" validate:"required"`
- // SecretKey is used to sign webhook payloads
- SecretKey string `json:"secret_key" validate:"required"`
- // Timeout is the HTTP client timeout (default: 10s)
- Timeout time.Duration `json:"timeout"`
- // MaxRetries is the maximum number of retry attempts (default: 3)
- MaxRetries int `json:"max_retries"`
- // RetryBackoff is the duration to wait between retries (default: 1s)
- RetryBackoff time.Duration `json:"retry_backoff"`
- }
- // DefaultConfig returns a Config with default values
- func DefaultConfig() Config {
- return Config{
- Timeout: 10 * time.Second,
- MaxRetries: 3,
- RetryBackoff: time.Second,
- }
- }
|