Support running 80/443 with TLS certificate files in confdir/domain/
This commit is contained in:
parent
05c6f03d20
commit
a00610a738
|
@ -17,6 +17,8 @@ def run(dev=False):
|
||||||
# Run plain HTTP redirect/acme server on port 80
|
# Run plain HTTP redirect/acme server on port 80
|
||||||
from . import httpredir
|
from . import httpredir
|
||||||
httpredir.app.prepare(port=80, motd=False)
|
httpredir.app.prepare(port=80, motd=False)
|
||||||
|
domain = opts["host"]
|
||||||
|
opts["ssl"] = str(config.conffile.parent / domain)
|
||||||
app.prepare(**opts, motd=False, dev=dev, auto_reload=dev)
|
app.prepare(**opts, motd=False, dev=dev, auto_reload=dev)
|
||||||
Sanic.serve()
|
Sanic.serve()
|
||||||
|
|
||||||
|
@ -27,7 +29,7 @@ def parse_listen(listen):
|
||||||
raise ValueError(f"Directory for unix socket does not exist: {unix.parent}/")
|
raise ValueError(f"Directory for unix socket does not exist: {unix.parent}/")
|
||||||
return "http://localhost", {"unix": unix}
|
return "http://localhost", {"unix": unix}
|
||||||
elif re.fullmatch(r"(\w+(-\w+)*\.)+\w{2,}", listen, re.UNICODE):
|
elif re.fullmatch(r"(\w+(-\w+)*\.)+\w{2,}", listen, re.UNICODE):
|
||||||
return f"https://{listen}", {"host": listen, "ssl": True}
|
return f"https://{listen}", {"host": listen, "port": 443, "ssl": True}
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
addr, _port = listen.split(":", 1)
|
addr, _port = listen.split(":", 1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user