oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

1package mapa
2
3import (
4 "log/slog"
5
6 "amadan.net/rastrillo/rastrillo/mail"
7)
8
9// Mailer builds the sign-in sender. Call it only where Mapa serves:
10// a CARLOS seed or one-shot runs with no control socket, and the agent
11// strips CARLOS_MAIL from it, so mail.FromCarlos there would refuse
12// once the app is switched to submission.
13//
14// mail.FromCarlos picks submission when CARLOS_MAIL=submit, else SMTP,
15// and refuses with neither, or with submission half set up. Logged mail
16// is only what LoadConfig admitted: MAPA_ALLOW_LOGGED_MAIL on loopback
17// with no channel at all.
18func Mailer(config Config, logger *slog.Logger) (mail.Sender, error) {
19 if !config.MailConfigured {
20 return mail.FromEnv("CARLOS", logger), nil
21 }
22 return mail.FromCarlos("CARLOS", logger)
23}
24