feat: integrate Resend for OTP email delivery and update configuration
This commit is contained in:
@@ -37,7 +37,7 @@ has been built.
|
||||
Local seeded admin:
|
||||
|
||||
- email: `[email protected]`
|
||||
- access uses OTP through Mailpit and is for local development only.
|
||||
- access uses OTP email delivery and needs mail provider config.
|
||||
|
||||
If you already had a MySQL volume from the old scaffold, create the local
|
||||
database/user once:
|
||||
@@ -93,6 +93,21 @@ python3 -m unittest scripts/test_generate_openapi.py
|
||||
The app serves the generated JSON at `/api/v1/openapi.json` and Swagger UI at
|
||||
`/api/v1/docs`.
|
||||
|
||||
## Email Delivery
|
||||
|
||||
OTP delivery uses Resend HTTP API through Drogon's async `HttpClient`.
|
||||
Set these environment variables before starting backend:
|
||||
|
||||
```bash
|
||||
export MAIL_PROVIDER=resend
|
||||
export RESEND_API_BASE_URL=https://api.resend.com
|
||||
export RESEND_API_KEY=re_xxx
|
||||
export MAIL_FROM=[email protected]
|
||||
```
|
||||
|
||||
Mailpit can still run locally for manual inspection or future integrations, but
|
||||
current backend OTP flow no longer speaks SMTP directly.
|
||||
|
||||
## Visione Lab
|
||||
|
||||
`scripts/lab/` is a small Streamlit frontend used only to test the backend
|
||||
@@ -137,11 +152,12 @@ backend deployment with MySQL and a local SMTP catcher. Configure the public
|
||||
domain in Dokploy against service `backend` and container port `5555`.
|
||||
|
||||
The runtime image includes `config.json`; override environment-specific values
|
||||
with Dokploy environment variables. The SMTP catcher service uses the
|
||||
with Dokploy environment variables. The Mailpit service uses the
|
||||
multi-architecture Mailpit image to avoid `exec format error` failures on ARM
|
||||
servers.
|
||||
|
||||
Set `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `MYSQL_ROOT_PASSWORD` and
|
||||
Set `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `MYSQL_ROOT_PASSWORD`,
|
||||
`RESEND_API_KEY`, `MAIL_FROM` and
|
||||
`CORS_ALLOWED_ORIGIN` in Dokploy environment variables. Use the exact browser
|
||||
origin without quotes or a trailing slash, for example
|
||||
`https://visione.studentindipendenti.it`.
|
||||
|
||||
Reference in New Issue
Block a user