mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 23:34:05 +08:00
Add LOAD_PGP_EMAIL_HANDLER param. Load PGP keys if LOAD_PGP_EMAIL_HANDLER is set
This commit is contained in:
parent
decda875db
commit
6cfd534192
2 changed files with 11 additions and 0 deletions
|
@ -226,3 +226,6 @@ if LOCAL_FILE_UPLOAD:
|
|||
os.makedirs(UPLOAD_DIR)
|
||||
|
||||
LANDING_PAGE_URL = os.environ.get("LANDING_PAGE_URL") or "https://simplelogin.io"
|
||||
|
||||
# Loading PGP keys when mail_handler runs. To be used locally when init_app is not called.
|
||||
LOAD_PGP_EMAIL_HANDLER = "LOAD_PGP_EMAIL_HANDLER" in os.environ
|
||||
|
|
|
@ -53,6 +53,7 @@ from app.config import (
|
|||
ALIAS_DOMAINS,
|
||||
POSTFIX_SUBMISSION_TLS,
|
||||
UNSUBSCRIBER,
|
||||
LOAD_PGP_EMAIL_HANDLER,
|
||||
)
|
||||
from app.email_utils import (
|
||||
send_email,
|
||||
|
@ -80,6 +81,7 @@ from app.models import (
|
|||
RefusedEmail,
|
||||
)
|
||||
from app.utils import random_string
|
||||
from init_app import load_pgp_public_keys
|
||||
from server import create_app
|
||||
|
||||
# used when an alias receives email from its own mailbox
|
||||
|
@ -857,5 +859,11 @@ if __name__ == "__main__":
|
|||
controller.start()
|
||||
LOG.d("Start mail controller %s %s", controller.hostname, controller.port)
|
||||
|
||||
if LOAD_PGP_EMAIL_HANDLER:
|
||||
LOG.warning("LOAD PGP keys")
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
load_pgp_public_keys(app)
|
||||
|
||||
while True:
|
||||
time.sleep(2)
|
||||
|
|
Loading…
Reference in a new issue