Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: email templates for monorepos #2723

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,11 @@ func (c *config) Load(path string, fsys fs.FS) error {
}
c.Functions[slug] = function
}

if err := c.Db.Seed.loadSeedPaths(builder.SupabaseDirPath, fsys); err != nil {
return err
}
if err := c.baseConfig.Validate(); err != nil {
if err := c.baseConfig.Validate(fsys); err != nil {
return err
}
c.Remotes = make(map[string]baseConfig, len(c.Overrides))
Expand All @@ -730,15 +731,15 @@ func (c *config) Load(path string, fsys fs.FS) error {
} else if undecoded := metadata.Undecoded(); len(undecoded) > 0 {
fmt.Fprintf(os.Stderr, "Unknown config fields: %+v\n", undecoded)
}
if err := base.Validate(); err != nil {
if err := base.Validate(fsys); err != nil {
return err
}
c.Remotes[name] = base
}
return nil
}

func (c *baseConfig) Validate() error {
func (c *baseConfig) Validate(fsys fs.FS) error {
if c.ProjectId == "" {
return errors.New("Missing required field in config: project_id")
} else if sanitized := sanitizeProjectId(c.ProjectId); sanitized != c.ProjectId {
Expand Down Expand Up @@ -833,8 +834,10 @@ func (c *baseConfig) Validate() error {
}
// Validate email config
for name, tmpl := range c.Auth.Email.Template {
if len(tmpl.ContentPath) > 0 && !fs.ValidPath(filepath.Clean(tmpl.ContentPath)) {
return errors.Errorf("Invalid config for auth.email.%s.content_path: %s", name, tmpl.ContentPath)
if len(tmpl.ContentPath) > 0 {
if _, err = fs.Stat(fsys, filepath.Clean(tmpl.ContentPath)); err != nil {
sweatybridge marked this conversation as resolved.
Show resolved Hide resolved
return errors.Errorf("Invalid config for auth.email.%s.content_path: %s", name, tmpl.ContentPath)
}
}
}
if c.Auth.Email.Smtp.Pass, err = maybeLoadEnv(c.Auth.Email.Smtp.Pass); err != nil {
Expand Down