Skip to content

Commit

Permalink
fix(auth): reorder credential fetching logic to prioritize Google Col…
Browse files Browse the repository at this point in the history
…ab token
  • Loading branch information
not-lain committed Jan 4, 2025
1 parent 7035d27 commit fb6e0fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions projects/fal_client/src/fal_client/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class MissingCredentialsError(Exception):


def fetch_credentials() -> str:
if colab_token := get_colab_token():
return colab_token
if key := os.getenv("FAL_KEY"):
return key
elif (key_id := os.getenv("FAL_KEY_ID")) and (
fal_key_secret := os.getenv("FAL_KEY_SECRET")
):
return f"{key_id}:{fal_key_secret}"
elif colab_token := get_colab_token():
return colab_token
else:
raise MissingCredentialsError(
"Please set the FAL_KEY environment variable to your API key, or set the FAL_KEY_ID and FAL_KEY_SECRET environment variables."
Expand Down

0 comments on commit fb6e0fc

Please sign in to comment.