-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
37 lines (28 loc) · 844 Bytes
/
Copy pathapp.py
File metadata and controls
37 lines (28 loc) · 844 Bytes
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
import logging
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from icha.env import cors_list
from icha.util.logger_filter import ExcludeFilter
logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler())
logger.setLevel("INFO")
app = FastAPI()
logging.getLogger("uvicorn.access").addFilter(ExcludeFilter(["/health"]))
if cors_list is None:
cors_list = "*"
app.add_middleware(
CORSMiddleware,
allow_origins=cors_list.split(","),
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 15
REFRESH_TOKEN_EXPIRE_MINUTES = 60 * 24 * 14
# noinspection PyUnresolvedReferences
import icha.apis
# noinspection PyUnresolvedReferences
import icha.error
# from icha.cmd import job
# app.cli.add_command(job)