mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Add load_dotenv from dotenv
This commit is contained in:
parent
2365c4e251
commit
75be1bf04e
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,9 @@ import os
|
|||
from fastapi.security.api_key import APIKeyHeader
|
||||
from fastapi import Security, HTTPException
|
||||
from starlette.status import HTTP_403_FORBIDDEN
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
apikey=os.getenv('RASPAP_API_KEY')
|
||||
#if env not set, set the api key to "insecure"
|
||||
|
@ -17,4 +20,5 @@ async def get_api_key(api_key_header: str = Security(api_key_header)):
|
|||
else:
|
||||
raise HTTPException(
|
||||
status_code=HTTP_403_FORBIDDEN, detail="403: Unauthorized"
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue