use robust envs

Former-commit-id: f3e194c3b3c40a3e6c3c5397ec0d859e6db614b5
This commit is contained in:
hiyouga
2024-05-14 21:36:42 +08:00
parent 84ff56c3a0
commit 6670b36c49
5 changed files with 6 additions and 6 deletions

View File

@@ -51,7 +51,7 @@ def create_app(chat_model: "ChatModel") -> "FastAPI":
allow_methods=["*"],
allow_headers=["*"],
)
api_key = os.environ.get("API_KEY", None)
api_key = os.environ.get("API_KEY")
security = HTTPBearer(auto_error=False)
async def verify_api_key(auth: Annotated[Optional[HTTPAuthorizationCredentials], Depends(security)]):