lighten mail handler
This commit is contained in:
parent
184397dc92
commit
dc206b41c7
|
@ -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):
|
||||
|
|
12
server.py
12
server.py
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue