mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Add load_dotenv from dotenv
This commit is contained in:
parent
2365c4e251
commit
75be1bf04e
@ -2,6 +2,9 @@ import os
|
|||||||
from fastapi.security.api_key import APIKeyHeader
|
from fastapi.security.api_key import APIKeyHeader
|
||||||
from fastapi import Security, HTTPException
|
from fastapi import Security, HTTPException
|
||||||
from starlette.status import HTTP_403_FORBIDDEN
|
from starlette.status import HTTP_403_FORBIDDEN
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
apikey=os.getenv('RASPAP_API_KEY')
|
apikey=os.getenv('RASPAP_API_KEY')
|
||||||
#if env not set, set the api key to "insecure"
|
#if env not set, set the api key to "insecure"
|
||||||
@ -18,3 +21,4 @@ async def get_api_key(api_key_header: str = Security(api_key_header)):
|
|||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTP_403_FORBIDDEN, detail="403: Unauthorized"
|
status_code=HTTP_403_FORBIDDEN, detail="403: Unauthorized"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user