Skip to content

Commit

Permalink
Bypass password lookup for anonymous connections.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 6, 2024
1 parent 2a1df8a commit 97c49f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ def client(username=None):
"""
username = username or os.environ.get('DB_USER') or 'anonymous'
cluster = os.environ.get('DB_CLUSTER') or 'cluster0.acvlhai.mongodb.net'
password = keyring.get_password(cluster, username) or 'coherent.build'
password = (
'coherent.build'
if username == 'anonymous'
else keyring.get_password(cluster, username)
)
uri = f'mongodb+srv://{username}:{password}@{cluster}/pypi'
return jaraco.mongodb.helper.connect_db(uri)

Expand Down

0 comments on commit 97c49f3

Please sign in to comment.