23 lines
494 B
Go
23 lines
494 B
Go
package configuration
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"errors"
|
||
|
|
"fmt"
|
||
|
|
)
|
||
|
|
|
||
|
|
var errRequestTimeoutTooLow = errors.New("request timeout is too low")
|
||
|
|
|
||
|
|
// HTTPClient is an HTTP client configuration.
|
||
|
|
type HTTPClient struct {
|
||
|
|
RequestTimeoutSeconds int64 `json:"request_timeout_seconds"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// Validate validates configuration for HTTP clients.
|
||
|
|
func (h *HTTPClient) Validate() error {
|
||
|
|
if h.RequestTimeoutSeconds < 1 {
|
||
|
|
return fmt.Errorf("validate HTTP client configuration: %w", errRequestTimeoutTooLow)
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|