Skip to content

Commit

Permalink
New SSL support for hypercorn
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Nov 12, 2019
1 parent 30bf81a commit 26ce573
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/appier/asgi.py
Expand Up @@ -61,11 +61,13 @@ def serve_uvicorn(self, host, port, **kwargs):
app_asgi = build_asgi_i(self)
uvicorn.run(app_asgi, host = host, port = port, reload=reload)

def serve_hypercorn(self, host, port, **kwargs):
def serve_hypercorn(self, host, port, ssl = False, key_file = None, cer_file = None, **kwargs):
import hypercorn.config
import hypercorn.asyncio
config = hypercorn.config.Config()
config.bind = ["%s:%d" % (host, port)]
config.keyfile = key_file if ssl else None
config.certfile = cer_file if ssl else None
app_asgi = build_asgi_i(self)
asyncio.run(hypercorn.asyncio.serve(app_asgi, config))

Expand Down

0 comments on commit 26ce573

Please sign in to comment.