Auth: Only regenerate auth on OSError

OSError means that a file wasn't found, which means auth tokens should
be rengenerated. Otherwise, fire the error and exit.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-12-17 17:33:51 -05:00
committed by Brian Dashore
parent a87e474660
commit 417cb958fa

View File

@@ -31,7 +31,7 @@ def load_auth_keys():
with open("api_tokens.yml", "r", encoding = 'utf8') as auth_file:
auth_keys_dict = yaml.safe_load(auth_file)
auth_keys = AuthKeys.model_validate(auth_keys_dict)
except Exception as _:
except OSError:
new_auth_keys = AuthKeys(
api_key = secrets.token_hex(16),
admin_key = secrets.token_hex(16)