From e4a88484456e84f51fd9c8eb4553644dfcf59c69 Mon Sep 17 00:00:00 2001 From: kingbri Date: Sun, 19 Nov 2023 00:52:39 -0500 Subject: [PATCH] Auth: Log API and admin key on startup Helpful for users who run headless or use Docker. Signed-off-by: kingbri --- auth.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auth.py b/auth.py index d74b8f2..ca987d1 100644 --- a/auth.py +++ b/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: