Skip to content

Commit

Permalink
Fix for --key being beaten by env variable, closes #71
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jul 10, 2023
1 parent 87df6a7 commit ae47f0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@ def get_key(key_arg, default_key, env_var=None):
keys = load_keys()
if key_arg in keys:
return keys[key_arg]
if env_var and os.environ.get(env_var):
return os.environ[env_var]
if key_arg:
return key_arg
if env_var and os.environ.get(env_var):
return os.environ[env_var]
default = keys.get(default_key)
if not default:
message = "No key found - add one using 'llm keys set {}'".format(default_key)
Expand Down

0 comments on commit ae47f0a

Please sign in to comment.