auto mail generation
This commit is contained in:
23
main.go
23
main.go
@@ -442,7 +442,28 @@ func main() {
|
||||
// ASSISTANT_AGENTS_DIR replaces the compiled-in agent definitions wholesale.
|
||||
// Empty uses the embedded ones, so a deployment cannot be broken by a missing
|
||||
// directory.
|
||||
f := facade.NewFacade(db.DB, db.CatalogueDB, embedder, chat, os.Getenv("ASSISTANT_AGENTS_DIR"), cfg.Assistant.Why())
|
||||
// Mail, for the invitation a newly onboarded merchant is sent.
|
||||
//
|
||||
// Optional in the same way as the model and the embedder: without it the
|
||||
// server still boots and still onboards tenants, and the create response
|
||||
// says the invitation was not sent and which variable is missing. Refusing
|
||||
// to start would make a mail relay a hard dependency of creating a shop,
|
||||
// which it is not.
|
||||
mailer, err := utils.NewMailer(cfg.Mail)
|
||||
if err != nil {
|
||||
// A configured-but-invalid sender, as opposed to no mail at all. That
|
||||
// fails every message, so it is worth stopping for rather than
|
||||
// discovering one silent invitation at a time.
|
||||
log.Fatal("mail:", err)
|
||||
}
|
||||
if mailer == nil {
|
||||
log.Printf("mail: OFF — %s", cfg.Mail.Why())
|
||||
} else {
|
||||
log.Printf("mail: sending as %s via %s", cfg.Mail.FromAddress, cfg.Mail.Address())
|
||||
}
|
||||
|
||||
f := facade.NewFacade(db.DB, db.CatalogueDB, embedder, chat,
|
||||
os.Getenv("ASSISTANT_AGENTS_DIR"), cfg.Assistant.Why(), mailer, cfg.Mail)
|
||||
|
||||
routes.RegisterRoutes(app, f)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user