summaryrefslogtreecommitdiff
path: root/jobedit.go
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-09-14 22:37:06 +0200
committerKevin Chabowski <kevin@kch42.de>2013-09-14 22:37:06 +0200
commitc0a06609919d09fbcb6326ff69cc455dd13506ef (patch)
tree7a56a337f9ac3b9b3fc099ea846fd884112469b7 /jobedit.go
parent33c32f1e026482d60de635656a53de723114fcb7 (diff)
downloadmailremind-c0a06609919d09fbcb6326ff69cc455dd13506ef.tar.gz
mailremind-c0a06609919d09fbcb6326ff69cc455dd13506ef.tar.bz2
mailremind-c0a06609919d09fbcb6326ff69cc455dd13506ef.zip
Reduced duplicate code for config reading.
Diffstat (limited to 'jobedit.go')
-rw-r--r--jobedit.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/jobedit.go b/jobedit.go
index ac9868d..cbe9225 100644
--- a/jobedit.go
+++ b/jobedit.go
@@ -4,6 +4,7 @@ import (
"github.com/gorilla/mux"
"github.com/gorilla/sessions"
"kch42.de/gostuff/mailremind/chronos"
+ "kch42.de/gostuff/mailremind/confhelper"
"kch42.de/gostuff/mailremind/model"
"log"
"net/http"
@@ -56,18 +57,8 @@ func chronToSchedTL(chron chronos.Chronos, u model.User) scheduleTpldata {
var maxSchedules, jobsLimit int
func initLimits() {
- schedules, err := conf.GetInt("limits", "schedules")
- if err != nil {
- log.Fatalf("Could not read config limits.schedules: %s", err)
- }
-
- jobs, err := conf.GetInt("limits", "jobs")
- if err != nil {
- log.Fatalf("Could not read config limits.jobs: %s", err)
- }
-
- maxSchedules = int(schedules)
- jobsLimit = int(jobs)
+ maxSchedules = int(confhelper.ConfIntOrFatal(conf, "limits", "schedules"))
+ jobsLimit = int(confhelper.ConfIntOrFatal(conf, "limits", "jobs"))
}
const bestTimeFmtEver = "2006-01-02 15:04:05"