summaryrefslogtreecommitdiff
path: root/core/core.go
diff options
context:
space:
mode:
authornytpu <alex@nytpu.com>2021-05-19 08:00:21 -0600
committernytpu <alex@nytpu.com>2021-05-19 08:02:28 -0600
commitf9d88722606e5c2570fe4237a64b5a1b22bf1789 (patch)
tree49db52ecb6a468f3340256166299f0978990b608 /core/core.go
parentac86835f6dcaaf4c42e0c1f2e4ff5eae24b9ff14 (diff)
add core.HistoryDays for variable history kept
Diffstat (limited to 'core/core.go')
-rw-r--r--core/core.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/core.go b/core/core.go
index 21487f6..ab1430f 100644
--- a/core/core.go
+++ b/core/core.go
@@ -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