lighten mail handler

This commit is contained in:
Son NK 2020-08-11 16:18:47 +02:00
parent 184397dc92
commit dc206b41c7
2 changed files with 14 additions and 2 deletions

View File

@ -99,7 +99,7 @@ from app.models import (
from app.pgp_utils import PGPException
from app.utils import random_string
from init_app import load_pgp_public_keys
from server import create_app
from server import create_app, create_light_app
_IP_HEADER = "X-SimpleLogin-Client-IP"
_MAILBOX_ID_HEADER = "X-SimpleLogin-Mailbox-ID"
@ -107,7 +107,7 @@ _MAILBOX_ID_HEADER = "X-SimpleLogin-Mailbox-ID"
# fix the database connection leak issue
# use this method instead of create_app
def new_app():
app = create_app()
app = create_light_app()
@app.teardown_appcontext
def shutdown_session(response_or_exc):

View File

@ -81,6 +81,18 @@ if SENTRY_DSN:
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
def create_light_app() -> Flask:
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = DB_URI
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.secret_key = FLASK_SECRET
init_extensions(app)
return app
def create_app() -> Flask:
app = Flask(__name__)
# SimpleLogin is deployed behind NGINX