Files

30 lines
608 B
Go
Raw Permalink Normal View History

2026-08-05 12:06:46 +05:00
package configuration
import (
"errors"
"fmt"
)
var errRSSValidate = errors.New("validate RSS configuration")
// RSS is an RSS parser configuration.
type RSS struct {
HTTPClient *HTTPClient `json:"http_client"`
Feeds []*Feed `json:"feeds"`
}
// Validate validates RSS parser configuration.
func (r *RSS) Validate() error {
for idx, feed := range r.Feeds {
if err := feed.Validate(); err != nil {
return fmt.Errorf("%w: feed %d: %w", errRSSValidate, idx, err)
}
}
if err := r.HTTPClient.Validate(); err != nil {
return fmt.Errorf("%w: %w", errRSSValidate, err)
}
return nil
}