Auth: Log API and admin key on startup
Helpful for users who run headless or use Docker. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
31bc418795
commit
e4a8848445
1 changed files with 6 additions and 0 deletions
6
auth.py
6
auth.py
|
|
@ -37,6 +37,12 @@ def load_auth_keys():
|
|||
with open("api_tokens.yml", "w") as auth_file:
|
||||
yaml.safe_dump(vars(auth_keys), auth_file, default_flow_style=False)
|
||||
|
||||
print(
|
||||
f"Your API key is: {auth_keys.api_key}\n"
|
||||
f"Your admin key is: {auth_keys.admin_key}\n\n"
|
||||
"If these keys get compromised, make sure to delete api_tokens.yml and restart the server. Have fun!"
|
||||
)
|
||||
|
||||
def check_api_key(x_api_key: str = Header(None), authorization: str = Header(None)):
|
||||
if x_api_key:
|
||||
if x_api_key in auth_keys.api_key:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue