add core.HistoryDays for variable history kept

This commit is contained in:
nytpu
2021-05-19 08:00:21 -06:00
parent ac86835f6d
commit f9d8872260
4 changed files with 10 additions and 4 deletions
+7 -1
View File
@@ -19,6 +19,7 @@ import (
"os"
"path/filepath"
"sync"
"time"
"golang.nytpu.com/comitium/localizations"
)
@@ -40,11 +41,14 @@ var (
// Timeout for requests
var Timeout int
// Number of days of history to keep
var HistoryDays time.Time
var Localizer *localizations.Localizer
// have to do this instead of the automatically called init() because
// initialization stuff requires parsing of command line args first
func Init(dataPath string, localizer *localizations.Localizer) error {
func Init(dataPath string, localizer *localizations.Localizer, days int) error {
Localizer = localizer
// initialize comitium.json & data maps
@@ -98,6 +102,8 @@ func Init(dataPath string, localizer *localizations.Localizer) error {
}
Footer = fmt.Sprintf("\n\n%s", footer)
HistoryDays = time.Now().AddDate(0, 0, -days)
Timeout = 10
return nil