Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterain98 committed May 17, 2024
1 parent 1305c43 commit f2eb809
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@
from api_config import *
import os
import uvicorn
from fastapi.middleware.cors import CORSMiddleware

md5_dict_cache = {}
app = FastAPI(docs_url=DOCS_URL, redoc_url=None)
db = MysqlConn(DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME)

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)


@app.get("/", response_class=RedirectResponse, status_code=302)
async def root():
Expand Down Expand Up @@ -335,4 +344,4 @@ async def get_checksum(this_game_name: str, background_tasks: BackgroundTasks):
for game_name in game_name_id_map.keys():
if not os.path.exists("./dict/{}".format(game_name)):
os.makedirs("./dict/{}".format(game_name))
uvicorn.run(app, host="0.0.0.0", port=8000)
uvicorn.run(app, host="0.0.0.0", port=8900, proxy_headers=True, forwarded_allow_ips="*")

0 comments on commit f2eb809

Please sign in to comment.