Skip to content

Commit dddee4c

Browse files
committed
correct handling of actual keys and secrets for S3
1 parent 419b6d1 commit dddee4c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

activestorage/active.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,21 @@ def _from_storage(self, stripped_indexer, drop_axes, out_shape, out_dtype,
348348

349349
# Create a shared session object.
350350
if self.storage_type == "s3":
351-
session = reductionist.get_session(S3_ACCESS_KEY, S3_SECRET_KEY,
352-
S3_ACTIVE_STORAGE_CACERT)
351+
if self.storage_options is not None:
352+
key, secret = None, None
353+
if "key" in self.storage_options:
354+
key = self.storage_options["key"]
355+
if "secret" in self.storage_options:
356+
secret = self.storage_options["secret"]
357+
if key and secret:
358+
session = reductionist.get_session(key, secret,
359+
S3_ACTIVE_STORAGE_CACERT)
360+
else:
361+
session = reductionist.get_session(S3_ACCESS_KEY, S3_SECRET_KEY,
362+
S3_ACTIVE_STORAGE_CACERT)
363+
else:
364+
session = reductionist.get_session(S3_ACCESS_KEY, S3_SECRET_KEY,
365+
S3_ACTIVE_STORAGE_CACERT)
353366
else:
354367
session = None
355368

0 commit comments

Comments
 (0)