Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Make `Must` config variables non-`Must` so that the app doesn't panic on their absence.

Kailash Nadh77913275479e
diff --git a/cmd/init.go b/cmd/init.go
index 9c7bd974..be2edbff 100644
--- a/cmd/init.go
+++ b/cmd/init.go
@@ -532,7 +532,7 @@ func initCampaignManager(msgrs []manager.Messenger, q *models.Queries, u *UrlCon
Concurrency: ko.Int("app.concurrency"),
MessageRate: ko.Int("app.message_rate"),
MaxSendErrors: ko.Int("app.max_send_errors"),
- FromEmail: ko.MustString("app.from_email"),
+ FromEmail: ko.String("app.from_email"),
IndividualTracking: ko.Bool("privacy.individual_tracking"),
UnsubURL: u.UnsubURL,
OptinURL: u.OptinURL,
@@ -743,8 +743,8 @@ func initNotifs(fs stuffbin.FileSystem, i *i18n.I18n, em *email.Emailer, u *UrlC
}
notifs.Initialize(notifs.Opt{
- FromEmail: ko.MustString("app.from_email"),
- SystemEmails: ko.MustStrings("app.notify_emails"),
+ FromEmail: ko.String("app.from_email"),
+ SystemEmails: ko.Strings("app.notify_emails"),
ContentType: contentType,
}, tpls, em, lo)
}
@@ -908,10 +908,15 @@ func initCaptcha() *captcha.Captcha {
}
// initCron initializes the cron job for refreshing slow query cache.
-
func initCron(co *core.Core) {
+ intval := ko.String("app.cache_slow_queries_interval")
+ if intval == "" {
+ lo.Println("error: invalid cron interval string")
+ return
+ }
+
c := cron.New()
- _, err := c.Add(ko.MustString("app.cache_slow_queries_interval"), func() {
+ _, err := c.Add(intval, func() {
lo.Println("refreshing slow query cache")
_ = co.RefreshMatViews(true)
lo.Println("done refreshing slow query cache")