Initial commit.

This commit is contained in:
2026-08-05 12:06:46 +05:00
commit f37a1422e2
21 changed files with 1026 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
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
}