marshal time.Duration as json string
This commit is contained in:
@@ -66,14 +66,14 @@ func (c *Config) From(app *config.App) {
|
||||
c.Scrapers = make([]scraper.Config, len(app.Scrape.Sources))
|
||||
for i := range app.Scrape.Sources {
|
||||
c.Scrapers[i] = scraper.Config{
|
||||
Past: app.Scrape.Past,
|
||||
Past: time.Duration(app.Scrape.Past),
|
||||
Name: app.Scrape.Sources[i].Name,
|
||||
Interval: app.Scrape.Sources[i].Interval,
|
||||
Interval: time.Duration(app.Scrape.Sources[i].Interval),
|
||||
Labels: model.Labels{},
|
||||
}
|
||||
c.Scrapers[i].Labels.FromMap(app.Scrape.Sources[i].Labels)
|
||||
if c.Scrapers[i].Interval <= 0 {
|
||||
c.Scrapers[i].Interval = app.Scrape.Interval
|
||||
c.Scrapers[i].Interval = time.Duration(app.Scrape.Interval)
|
||||
}
|
||||
if app.Scrape.Sources[i].RSS != nil {
|
||||
c.Scrapers[i].RSS = &scraper.ScrapeSourceRSS{
|
||||
|
||||
@@ -55,7 +55,7 @@ const maxPast = 15 * 24 * time.Hour
|
||||
|
||||
func (c *Config) Validate() error {
|
||||
if c.Past <= 0 {
|
||||
c.Past = 3 * timeutil.Day
|
||||
c.Past = timeutil.Day
|
||||
}
|
||||
if c.Past > maxPast {
|
||||
c.Past = maxPast
|
||||
|
||||
Reference in New Issue
Block a user