diff options
author | Kevin Chabowski <kevin@kch42.de> | 2013-09-14 22:37:06 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2013-09-14 22:37:06 +0200 |
commit | c0a06609919d09fbcb6326ff69cc455dd13506ef (patch) | |
tree | 7a56a337f9ac3b9b3fc099ea846fd884112469b7 /jobedit.go | |
parent | 33c32f1e026482d60de635656a53de723114fcb7 (diff) | |
download | mailremind-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.go | 15 |
1 files changed, 3 insertions, 12 deletions
@@ -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" |