Skip to content

Commit

Permalink
Added mailhog email server
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonresende committed Dec 24, 2024
1 parent 065790c commit 91ce7d3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ services:
- ./nextjs-frontend:/app
- nextjs-node-modules:/app/node_modules
- ./local-shared-data:/app/shared-data
mailhog:
image: mailhog/mailhog
ports:
- "1025:1025" # SMTP server
- "8025:8025" # Web UI
networks:
- my_network

volumes:
postgres_data:
Expand Down
17 changes: 11 additions & 6 deletions fastapi_backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Local database (replace localhost with db if you are using docker)
DATABASE_URL=postgresql+asyncpg://postgres:password@localhost:5432/mydatabase

# Test database
# Test database(replace localhost with db_test if you are using docker)
TEST_DATABASE_URL=postgresql+asyncpg://postgres:password@localhost:5433/testdatabase


Expand All @@ -16,11 +16,16 @@ VERIFICATION_SECRET_KEY=your_verification_secret_key
# OpenAPI genrated file output path
OPENAPI_OUTPUT_FILE=../nextjs-frontend/openapi.json

# Email
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=your_email_app_password
MAIL_FROM=[email protected]
MAIL_SERVER=your_smtp_server.com

# Localhost Email configuration (replace localhost with mailhog if you are using docker)
MAIL_USERNAME=test
MAIL_PASSWORD=test
MAIL_FROM=[email protected]
MAIL_PORT=1025
MAIL_SERVER=localhost
MAIL_STARTTLS=False
MAIL_SSL_TLS=False
USE_CREDENTIALS=False

# Frontend (NextJS)
FRONTEND_URL=http://localhost:3000
2 changes: 1 addition & 1 deletion fastapi_backend/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Settings(BaseSettings):
MAIL_PASSWORD: str | None = None
MAIL_FROM: str | None = None
MAIL_SERVER: str | None = None
MAIL_PORT: int = 587
MAIL_PORT: int | None = None
MAIL_FROM_NAME: str = "FastAPI template"
MAIL_STARTTLS: bool = True
MAIL_SSL_TLS: bool = False
Expand Down

0 comments on commit 91ce7d3

Please sign in to comment.