-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
29 lines (22 loc) · 838 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import argparse
import ssl
import uvicorn
from app.config import Settings
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--port', type=int, default=8000, help='Port to bind on')
parser.add_argument('-r', '--reload', type=bool, default=False, help='Reload when changes found')
parser.add_argument('-s', '--settings', type=str, default='settings.json', help='Settings file name')
args = parser.parse_args()
settings = Settings()
uvicorn.run(
'app.main:app',
host='0.0.0.0',
port=args.port,
reload=args.reload,
ssl_cert_reqs=ssl.CERT_REQUIRED,
ssl_version=ssl.PROTOCOL_TLSv1_2,
ssl_keyfile=settings.server_key_file,
ssl_certfile=settings.server_cert_file,
ssl_ca_certs=settings.ca_file
)