Skip to content

Commit 7791327

Browse files
committed
Make Must config variables non-Must so that the app doesn't panic on their absence.
1 parent 8fc3d27 commit 7791327

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

cmd/init.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ func initCampaignManager(msgrs []manager.Messenger, q *models.Queries, u *UrlCon
532532
Concurrency: ko.Int("app.concurrency"),
533533
MessageRate: ko.Int("app.message_rate"),
534534
MaxSendErrors: ko.Int("app.max_send_errors"),
535-
FromEmail: ko.MustString("app.from_email"),
535+
FromEmail: ko.String("app.from_email"),
536536
IndividualTracking: ko.Bool("privacy.individual_tracking"),
537537
UnsubURL: u.UnsubURL,
538538
OptinURL: u.OptinURL,
@@ -743,8 +743,8 @@ func initNotifs(fs stuffbin.FileSystem, i *i18n.I18n, em *email.Emailer, u *UrlC
743743
}
744744

745745
notifs.Initialize(notifs.Opt{
746-
FromEmail: ko.MustString("app.from_email"),
747-
SystemEmails: ko.MustStrings("app.notify_emails"),
746+
FromEmail: ko.String("app.from_email"),
747+
SystemEmails: ko.Strings("app.notify_emails"),
748748
ContentType: contentType,
749749
}, tpls, em, lo)
750750
}
@@ -908,10 +908,15 @@ func initCaptcha() *captcha.Captcha {
908908
}
909909

910910
// initCron initializes the cron job for refreshing slow query cache.
911-
912911
func initCron(co *core.Core) {
912+
intval := ko.String("app.cache_slow_queries_interval")
913+
if intval == "" {
914+
lo.Println("error: invalid cron interval string")
915+
return
916+
}
917+
913918
c := cron.New()
914-
_, err := c.Add(ko.MustString("app.cache_slow_queries_interval"), func() {
919+
_, err := c.Add(intval, func() {
915920
lo.Println("refreshing slow query cache")
916921
_ = co.RefreshMatViews(true)
917922
lo.Println("done refreshing slow query cache")

0 commit comments

Comments
 (0)