From e14eb723bfb90109de51b60a8ab93149e557b728 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 27 Aug 2021 10:49:36 +0200 Subject: [PATCH] mail on localhost by default --- .env-exemple | 3 +-- config.py | 10 ++++------ tools/configure-scodoc9.sh | 3 --- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.env-exemple b/.env-exemple index 02b219e5c..15a9e5db4 100644 --- a/.env-exemple +++ b/.env-exemple @@ -6,9 +6,8 @@ FLASK_APP=scodoc.py FLASK_ENV=production # ou "development" si vous développez -# Envois de mails: décommenter et adapter +# Envois de mails: adapter si nécessaire # MAIL_SERVER=localhost -# MAIL_PORT=25 # Obligatoire: SCODOC_ADMIN_MAIL="emmanuel@viennet.net" diff --git a/config.py b/config.py index ced04ffbc..a25603254 100755 --- a/config.py +++ b/config.py @@ -11,15 +11,13 @@ load_dotenv(os.path.join(BASEDIR, ".env")) class Config: """General configuration. Mostly loaded from environment via .env""" + SQLALCHEMY_DATABASE_URI = None # set in subclass + FLASK_ENV = None # # set in subclass SECRET_KEY = os.environ.get("SECRET_KEY") or "90e01e75831e4176a3c70d29564b425f" - SQLALCHEMY_DATABASE_URI = ( - os.environ.get("USERS_DATABASE_URI") - or "postgresql://scodoc@localhost:5432/SCO8USERS" - ) SQLALCHEMY_TRACK_MODIFICATIONS = False LOG_TO_STDOUT = os.environ.get("LOG_TO_STDOUT") - MAIL_SERVER = os.environ.get("MAIL_SERVER") - MAIL_PORT = int(os.environ.get("MAIL_PORT") or 25) + MAIL_SERVER = os.environ.get("MAIL_SERVER", "localhost") + MAIL_PORT = int(os.environ.get("MAIL_PORT", 25)) MAIL_USE_TLS = os.environ.get("MAIL_USE_TLS") is not None MAIL_USERNAME = os.environ.get("MAIL_USERNAME") MAIL_PASSWORD = os.environ.get("MAIL_PASSWORD") diff --git a/tools/configure-scodoc9.sh b/tools/configure-scodoc9.sh index 2c60d1563..f058378d5 100755 --- a/tools/configure-scodoc9.sh +++ b/tools/configure-scodoc9.sh @@ -88,9 +88,6 @@ then FLASK_APP=scodoc.py FLASK_ENV=production -MAIL_SERVER=localhost -MAIL_PORT=25 - SCODOC_ADMIN_MAIL="$SCODOC_ADMIN_MAIL" # important: le mail de admin SECRET_KEY="$SECRET_KEY" # une chaine aléatoire"