This repository has been archived on 2022-09-04. You can view files and clone it, but cannot push or open issues or pull requests.
dataupdater/cron/config.go

25 lines
413 B
Go
Raw Normal View History

package cron
import (
"github.com/go-pg/pg/v10"
"github.com/pkg/errors"
2021-07-11 07:25:12 +00:00
2021-07-16 15:49:01 +00:00
"github.com/tribalwarshelp/dataupdater/queue"
)
type Config struct {
2021-07-11 07:25:12 +00:00
DB *pg.DB
Queue *queue.Queue
RunOnInit bool
}
func validateConfig(cfg *Config) error {
if cfg == nil || cfg.DB == nil {
2021-05-14 12:57:05 +00:00
return errors.New("cfg.DB is required")
}
2021-07-11 07:25:12 +00:00
if cfg.Queue == nil {
return errors.New("cfg.Queue is required")
}
return nil
}