Skip to content

Commit fafcf09

Browse files
committed
omit S3 key/secret from storage_options when env vars are unset
1 parent 053f33d commit fafcf09

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

deep_code/utils/helper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ def open_dataset(
6363
"root": os.environ.get("S3_USER_STORAGE_BUCKET", root),
6464
"storage_options": {
6565
"anon": False,
66-
"key": os.environ.get("S3_USER_STORAGE_KEY"),
67-
"secret": os.environ.get("S3_USER_STORAGE_SECRET"),
66+
**({
67+
"key": os.environ["S3_USER_STORAGE_KEY"],
68+
"secret": os.environ["S3_USER_STORAGE_SECRET"],
69+
} if os.environ.get("S3_USER_STORAGE_KEY") and os.environ.get("S3_USER_STORAGE_SECRET") else {}),
6870
},
6971
},
7072
},

0 commit comments

Comments
 (0)