diff options
| author | Paul Buetow <paul@buetow.org> | 2024-08-22 10:31:43 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-08-22 10:31:43 +0300 |
| commit | f2b9094e301ac764930feaca93f1f0705f3e1a04 (patch) | |
| tree | 62dedc06f8a90c1c4f9906269e8e44698f530257 /internal/config | |
| parent | b9aac1245c586ed3a78713e7b47f1e00c71a9aa2 (diff) | |
initial scheduler
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/server/server.go | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/internal/config/server/server.go b/internal/config/server/server.go index b43166c..88211a4 100644 --- a/internal/config/server/server.go +++ b/internal/config/server/server.go @@ -10,14 +10,15 @@ import ( ) type ServerConfig struct { - ListenAddr string `json:"ListenAddr,omitempty"` - Partner string `json:"Partner,omitempty"` - APIKey string `json:"APIKey,omitempty"` - DataDir string `json:"StateDir,omitempty"` - EmailTo string `json:"EmailTo,omitempty"` - EmailFrom string `json:"EmailFrom,omitempty"` - SMTPServer string `json:"SMTPServer,omitempty"` - CRONMergeIntervalS int `json:"CRONMergeInterval,omitempty"` + ListenAddr string `json:"ListenAddr,omitempty"` + Partner string `json:"Partner,omitempty"` + APIKey string `json:"APIKey,omitempty"` + DataDir string `json:"StateDir,omitempty"` + EmailTo string `json:"EmailTo,omitempty"` + EmailFrom string `json:"EmailFrom,omitempty"` + SMTPServer string `json:"SMTPServer,omitempty"` + MergeIntervalS int `json:"MergeInterval,omitempty"` + ScheduleIntervalS int `json:"ScheduleInterval,omitempty"` } func New(configFile string) (ServerConfig, error) { @@ -38,7 +39,10 @@ func New(configFile string) (ServerConfig, error) { return fmt.Sprintf("%s:25", hostname) }) - conf.CRONMergeIntervalS = config.EnvToInt("GOS_CRON_MERGE_INTERVAL", 3600) + const oneHour = 3600 + conf.MergeIntervalS = config.EnvToInt("GOS_MERGE_INTERVAL", oneHour) + conf.ScheduleIntervalS = config.EnvToInt("GOS_SCHEDULER_INTERVAL", oneHour*6) + return conf, nil } |
