From 83d5a6d6adef4334bb0548074fc4d265496144e8 Mon Sep 17 00:00:00 2001 From: Inder Singh <85822513+singh-inder@users.noreply.github.com> Date: Sun, 25 Jan 2026 21:54:33 +0530 Subject: [PATCH 1/2] fix: mount notification email templates --- internal/start/start.go | 42 +++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/internal/start/start.go b/internal/start/start.go index 1184b6590..f92fcdd93 100644 --- a/internal/start/start.go +++ b/internal/start/start.go @@ -467,12 +467,12 @@ EOF } binds := []string{} - for id, tmpl := range utils.Config.Auth.Email.Template { - if len(tmpl.ContentPath) == 0 { - continue + mountEmailTemplates := func(id, contentPath string) error { + if len(contentPath) == 0 { + return nil } - hostPath := tmpl.ContentPath - if !filepath.IsAbs(tmpl.ContentPath) { + hostPath := contentPath + if !filepath.IsAbs(contentPath) { var err error hostPath, err = filepath.Abs(hostPath) if err != nil { @@ -481,6 +481,17 @@ EOF } dockerPath := path.Join(nginxEmailTemplateDir, id+filepath.Ext(hostPath)) binds = append(binds, fmt.Sprintf("%s:%s:rw", hostPath, dockerPath)) + return nil + } + + for id, tmpl := range utils.Config.Auth.Email.Template { + mountEmailTemplates(id, tmpl.ContentPath) + } + + for id, tmpl := range utils.Config.Auth.Email.Notification { + if tmpl.Enabled { + mountEmailTemplates(id+"_notification", tmpl.ContentPath) + } } dockerPort := uint16(8000) @@ -655,23 +666,34 @@ EOF env = append(env, fmt.Sprintf("GOTRUE_SESSIONS_INACTIVITY_TIMEOUT=%v", utils.Config.Auth.Sessions.InactivityTimeout)) } - for id, tmpl := range utils.Config.Auth.Email.Template { - if len(tmpl.ContentPath) > 0 { + addMailerEnvVars := func(id, contentPath string, subject *string) { + if len(contentPath) > 0 { env = append(env, fmt.Sprintf("GOTRUE_MAILER_TEMPLATES_%s=http://%s:%d/email/%s", strings.ToUpper(id), utils.KongId, nginxTemplateServerPort, - id+filepath.Ext(tmpl.ContentPath), + id+filepath.Ext(contentPath), )) } - if tmpl.Subject != nil { + if subject != nil { env = append(env, fmt.Sprintf("GOTRUE_MAILER_SUBJECTS_%s=%s", strings.ToUpper(id), - *tmpl.Subject, + *subject, )) } } + for id, tmpl := range utils.Config.Auth.Email.Template { + addMailerEnvVars(id, tmpl.ContentPath, tmpl.Subject) + } + + for id, tmpl := range utils.Config.Auth.Email.Notification { + if tmpl.Enabled { + env = append(env, fmt.Sprintf("GOTRUE_MAILER_NOTIFICATIONS_%s_ENABLED=true", strings.ToUpper(id))) + addMailerEnvVars(id+"_notification", tmpl.ContentPath, tmpl.Subject) + } + } + switch { case utils.Config.Auth.Sms.Twilio.Enabled: env = append( From 7bc1166684fbe6c449e407dd3ad2941629a62f2a Mon Sep 17 00:00:00 2001 From: Inder Singh <85822513+singh-inder@users.noreply.github.com> Date: Sun, 25 Jan 2026 22:02:53 +0530 Subject: [PATCH 2/2] return errors --- internal/start/start.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/start/start.go b/internal/start/start.go index f92fcdd93..cc5240550 100644 --- a/internal/start/start.go +++ b/internal/start/start.go @@ -485,12 +485,18 @@ EOF } for id, tmpl := range utils.Config.Auth.Email.Template { - mountEmailTemplates(id, tmpl.ContentPath) + err := mountEmailTemplates(id, tmpl.ContentPath) + if err != nil { + return err + } } for id, tmpl := range utils.Config.Auth.Email.Notification { if tmpl.Enabled { - mountEmailTemplates(id+"_notification", tmpl.ContentPath) + err := mountEmailTemplates(id+"_notification", tmpl.ContentPath) + if err != nil { + return err + } } }