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