-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.py
46 lines (36 loc) · 1.03 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import uvicorn
from dotenv import load_dotenv
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
load_dotenv()
# from controller.private_api import app_private
from controller.public_api import app_public
origins = ["*"]
app = FastAPI()
# app.mount("/api", app_private)
app.mount("/public", app_public)
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.add_middleware(GZipMiddleware)
if __name__ == '__main__':
if(os.environ["ENV"] == 'prod'):
uvicorn.run("main:app",
host="0.0.0.0",
port=80,
reload=True,
ssl_keyfile="privkey.pem",
ssl_certfile="cert.pem"
)
else:
uvicorn.run("main:app",
host="0.0.0.0",
port=80,
reload=True
)