mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
doveauth-http: deploying HTTP route for account creation
This commit is contained in:
@@ -8,10 +8,12 @@ version = "0.1"
|
||||
dependencies = [
|
||||
"aiosmtpd",
|
||||
"flask",
|
||||
"gunicorn",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
doveauth = "chatmaild.doveauth:main"
|
||||
doveauth-http = "chatmaild.web:main"
|
||||
filtermail = "chatmaild.filtermail:main"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
|
||||
10
chatmaild/src/chatmaild/doveauth-http.service
Normal file
10
chatmaild/src/chatmaild/doveauth-http.service
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=HTTP endpoint for creating chatmail accounts
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/gunicorn --timeout 60 -b :3691 -w 1 chatmaild.web:main
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,5 +1,6 @@
|
||||
from flask import Flask, jsonify, request
|
||||
import time
|
||||
import os
|
||||
|
||||
from database import Database
|
||||
from util import gen_password, get_valid_email_addr, encrypt_password
|
||||
@@ -37,3 +38,11 @@ def create_app_from_db(db):
|
||||
)
|
||||
|
||||
return app
|
||||
|
||||
|
||||
def main():
|
||||
"""(debugging-only!) serve http account creation Web API on localhost"""
|
||||
db_path = os.getenv("CHATMAIL_DATABASE", "/home/vmail/passdb.sqlite")
|
||||
app = create_app_from_db_path(db_path)
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True, host="localhost", port=3691)
|
||||
|
||||
@@ -46,6 +46,7 @@ def _install_chatmaild() -> None:
|
||||
|
||||
for fn in (
|
||||
"doveauth",
|
||||
"doveauth-http",
|
||||
"filtermail",
|
||||
):
|
||||
files.put(
|
||||
|
||||
@@ -42,6 +42,10 @@ http {
|
||||
# as directory, then fall back to displaying a 404.
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location /new_email {
|
||||
proxy_pass http://localhost:3691/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user