@@ -181,9 +181,10 @@ type AuthConfig struct { |
| 181 | 181 | BaseURL string `toml:"base_url"` // e.g. https://shithub.example |
| 182 | 182 | SiteName string `toml:"site_name"` |
| 183 | 183 | EmailFrom string `toml:"email_from"` |
| 184 | | - EmailBackend string `toml:"email_backend"` // stdout | smtp | postmark |
| 184 | + EmailBackend string `toml:"email_backend"` // stdout | smtp | postmark | resend |
| 185 | 185 | SMTP SMTPConfig `toml:"smtp"` |
| 186 | 186 | Postmark PostmarkConfig `toml:"postmark"` |
| 187 | + Resend ResendConfig `toml:"resend"` |
| 187 | 188 | Argon2 Argon2Config `toml:"argon2"` |
| 188 | 189 | TOTPKeyB64 string `toml:"totp_key_b64"` // base64 32-byte AEAD key for at-rest TOTP secrets |
| 189 | 190 | SSH SSHAuthConfig `toml:"ssh"` |
@@ -207,6 +208,11 @@ type SMTPConfig struct { |
| 207 | 208 | Password string `toml:"password"` |
| 208 | 209 | } |
| 209 | 210 | |
| 211 | +// ResendConfig holds Resend transactional API settings. |
| 212 | +type ResendConfig struct { |
| 213 | + APIKey string `toml:"api_key"` |
| 214 | +} |
| 215 | + |
| 210 | 216 | // PostmarkConfig holds Postmark transactional API settings. |
| 211 | 217 | type PostmarkConfig struct { |
| 212 | 218 | ServerToken string `toml:"server_token"` |
@@ -376,9 +382,9 @@ func Validate(c *Config) error { |
| 376 | 382 | return err |
| 377 | 383 | } |
| 378 | 384 | switch c.Auth.EmailBackend { |
| 379 | | - case "stdout", "smtp", "postmark": |
| 385 | + case "stdout", "smtp", "postmark", "resend": |
| 380 | 386 | default: |
| 381 | | - return fmt.Errorf("config: auth.email_backend: must be stdout|smtp|postmark, got %q", c.Auth.EmailBackend) |
| 387 | + return fmt.Errorf("config: auth.email_backend: must be stdout|smtp|postmark|resend, got %q", c.Auth.EmailBackend) |
| 382 | 388 | } |
| 383 | 389 | if c.Auth.EmailBackend == "smtp" && c.Auth.SMTP.Addr == "" { |
| 384 | 390 | return errors.New("config: auth.smtp.addr is required when email_backend=smtp") |
@@ -386,6 +392,9 @@ func Validate(c *Config) error { |
| 386 | 392 | if c.Auth.EmailBackend == "postmark" && c.Auth.Postmark.ServerToken == "" { |
| 387 | 393 | return errors.New("config: auth.postmark.server_token is required when email_backend=postmark") |
| 388 | 394 | } |
| 395 | + if c.Auth.EmailBackend == "resend" && c.Auth.Resend.APIKey == "" { |
| 396 | + return errors.New("config: auth.resend.api_key is required when email_backend=resend") |
| 397 | + } |
| 389 | 398 | if c.Auth.BaseURL == "" { |
| 390 | 399 | return errors.New("config: auth.base_url is required (used in email links)") |
| 391 | 400 | } |