Closed samdoolin closed 5 months ago
S3Storage looks for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in settings and in os.environ.
S3Storage
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
settings
os.environ
https://github.com/jschneier/django-storages/blob/d84ad923eb14a3406308d0b1512cc3ee25bd8db8/storages/backends/s3.py#L366
However it only looks for AWS_SESSION_TOKEN in settings but not in os.environ.
AWS_SESSION_TOKEN
https://github.com/jschneier/django-storages/blob/d84ad923eb14a3406308d0b1512cc3ee25bd8db8/storages/backends/s3.py#L380
All 3 are used to initialise the the boto3.Session.
boto3.Session
https://github.com/jschneier/django-storages/blob/d84ad923eb14a3406308d0b1512cc3ee25bd8db8/storages/backends/s3.py#L457
Please consider allowing security_token to fall back to os.environ as well? Otherwise I need to manually wire AWS_SESSION_TOKEN into settings to avoid url failures (InvalidAccessKeyId). And/or describe how AWS_SESSION_TOKEN is handled in the docs.
security_token
Thanks
Sure, please open a PR
does https://github.com/jschneier/django-storages/pull/1399 look ok?
S3Storage
looks forAWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
insettings
and inos.environ
.https://github.com/jschneier/django-storages/blob/d84ad923eb14a3406308d0b1512cc3ee25bd8db8/storages/backends/s3.py#L366
However it only looks for
AWS_SESSION_TOKEN
insettings
but not inos.environ
.https://github.com/jschneier/django-storages/blob/d84ad923eb14a3406308d0b1512cc3ee25bd8db8/storages/backends/s3.py#L380
All 3 are used to initialise the the
boto3.Session
.https://github.com/jschneier/django-storages/blob/d84ad923eb14a3406308d0b1512cc3ee25bd8db8/storages/backends/s3.py#L457
Please consider allowing
security_token
to fall back toos.environ
as well? Otherwise I need to manually wireAWS_SESSION_TOKEN
intosettings
to avoid url failures (InvalidAccessKeyId). And/or describe howAWS_SESSION_TOKEN
is handled in the docs.Thanks