mirror of
https://github.com/Mailu/Mailu.git
synced 2025-01-16 02:46:44 +02:00
Return the server address dynamically
This commit is contained in:
parent
9e3e86f0d0
commit
5786bb3e1b
@ -1,5 +1,7 @@
|
||||
from mailu import db, models
|
||||
|
||||
import socket
|
||||
|
||||
|
||||
SUPPORTED_AUTH_METHODS = ["none", "plain"]
|
||||
|
||||
@ -12,6 +14,12 @@ STATUSES = {
|
||||
}
|
||||
|
||||
|
||||
SERVER_MAP = {
|
||||
"imap": ("imap", 143),
|
||||
"smtp": ("smtp", 25)
|
||||
}
|
||||
|
||||
|
||||
def handle_authentication(headers):
|
||||
""" Handle an HTTP nginx authentication request
|
||||
See: http://nginx.org/en/docs/mail/ngx_mail_auth_http_module.html#protocol
|
||||
@ -57,8 +65,6 @@ def get_status(protocol, status):
|
||||
|
||||
|
||||
def get_server(protocol):
|
||||
servers = {
|
||||
"imap": ("172.18.0.12", 143),
|
||||
"smtp": ("172.18.0.9", 25)
|
||||
}
|
||||
return servers[protocol]
|
||||
hostname, port = SERVER_MAP[protocol]
|
||||
address = socket.gethostbyname(hostname)
|
||||
return address, port
|
||||
|
@ -11,4 +11,3 @@ def nginx_authentication():
|
||||
for key, value in headers.items():
|
||||
response.headers[key] = str(value)
|
||||
return response
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user