From d040f2f9eb682c2621dc0cbe465eed297b3e00c6 Mon Sep 17 00:00:00 2001 From: Mohamad Liyaghi Date: Wed, 31 Jul 2024 13:20:30 +0330 Subject: [PATCH] feat(settings): email configs and smtp4dev --- config/settings/core.py | 8 ++++++++ docker-compose.base.yaml | 13 +++++++++++++ docker-compose.yaml | 4 ++++ envs/.env.local | 7 +++++++ envs/.env.prod | 7 +++++++ 5 files changed, 39 insertions(+) diff --git a/config/settings/core.py b/config/settings/core.py index 406b991..dbf2a3e 100644 --- a/config/settings/core.py +++ b/config/settings/core.py @@ -125,3 +125,11 @@ }, } } + +# Email configs +EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" +EMAIL_HOST = config("EMAIL_HOST") +EMAIL_HOST_USER = config("EMAIL_USER") +EMAIL_HOST_PASSWORD = config("EMAIL_PASSWORD") +EMAIL_PORT = config("EMAIL_PORT") +DEFAULT_FROM_EMAIL = config("EMAIL_FROM") diff --git a/docker-compose.base.yaml b/docker-compose.base.yaml index e521454..db349bb 100644 --- a/docker-compose.base.yaml +++ b/docker-compose.base.yaml @@ -15,6 +15,8 @@ services: depends_on: postgres: condition: service_healthy + redis: + condition: service_healthy postgres: restart: on-failure container_name: food-anywhere-postgres @@ -43,6 +45,17 @@ services: interval: 2s timeout: 5s retries: 5 + smtp4dev: + image: rnwood/smtp4dev:v3 + restart: always + container_name: food-anywhere-smtp4dev + ports: + - "5000:80" + expose: + - "25" + networks: + - main + networks: main: diff --git a/docker-compose.yaml b/docker-compose.yaml index 3568697..5f830fc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -21,6 +21,10 @@ services: extends: service: redis file: docker-compose.base.yaml + smtp4dev: + extends: + service: smtp4dev + file: docker-compose.base.yaml networks: main: diff --git a/envs/.env.local b/envs/.env.local index 29d55e9..9d0dddd 100644 --- a/envs/.env.local +++ b/envs/.env.local @@ -9,3 +9,10 @@ POSTGRES_PORT=5432 # Redis CACHE_DB_URL='redis://redis:6379/2' + +# Email +EMAIL_HOST='smtp4dev' +EMAIL_USER='' +EMAIL_PASSWORD='' +EMAIL_PORT=25 +EMAIL_FROM='support@FoodAnywhere.com' diff --git a/envs/.env.prod b/envs/.env.prod index e055bd9..519e542 100644 --- a/envs/.env.prod +++ b/envs/.env.prod @@ -9,3 +9,10 @@ POSTGRES_PORT=5432 # Redis CACHE_DB_URL='redis://redis:6379/2' + +# Email +EMAIL_HOST='MAILSERVER' +EMAIL_USER='' +EMAIL_PASSWORD='' +EMAIL_PORT=25 +EMAIL_FROM='support@FoodAnywhere.com'