Skip to content

Commit

Permalink
feat: Introduce S3_DEFAULT_ACL
Browse files Browse the repository at this point in the history
Introduce a new configuration option, S3_DEFAULT_ACL, defaulting to
None.

When set, this populates the AWS_DEFAULT_ACL option for the S3Storage
backend.

Reference:
https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
  • Loading branch information
fghaas committed Oct 2, 2024
1 parent 7c012cb commit 3f31991
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* [Enhancement] Introduce `S3_DEFAULT_ACL` configuration option.

## Version 1.5.0 (2024-08-08)

* [Enhancement] Support Tutor 18 and Open edX Redwood.
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ Plugin configuration
* `S3_SIGNATURE_VERSION` (default: `"s3v4"`)
* `S3_CUSTOM_DOMAIN` (default: `""`) - do not set if you are using AWS S3
* `S3_PROFILE_IMAGE_CUSTOM_DOMAIN` (default: `""`)
* `S3_DEFAULT_ACL` (default: `None`[^null], meaning inherit from the parent bucket and fall back to the S3 provider's default canned ACL[^private] if unset)

These values can be modified by the `tutor config save --set
PARAM_NAME=VALUE` command, or by setting them in `$(tutor config
printroot)/config.yaml`.

[^null]: If you want to explicitly set a value to None in `config.yaml`, use `!!null`.

[^private]: In AWS S3, the default ACL is `private`.

Depending on the nature and configuration of your S3-compatible
service, some of these values may be required to set.

Expand Down
2 changes: 1 addition & 1 deletion tutors3/patches/openedx-common-settings
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AWS_S3_ENDPOINT_URL = "{{ "https" if S3_USE_SSL else "http" }}://{{ S3_HOST }}{%

AWS_S3_USE_SSL = {{ "True" if S3_USE_SSL else "False" }}
AWS_S3_SECURE_URLS = {{ "True" if S3_USE_SSL else "False" }}
AWS_DEFAULT_ACL = None # inherit from the bucket
AWS_DEFAULT_ACL = {{ S3_DEFAULT_ACL }} # if None, inherit from the bucket
AWS_S3_ADDRESSING_STYLE = "{{ S3_ADDRESSING_STYLE }}"
AWS_AUTO_CREATE_BUCKET = False

Expand Down
1 change: 1 addition & 0 deletions tutors3/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"ADDRESSING_STYLE": "auto",
"SIGNATURE_VERSION": "s3v4",
"CUSTOM_DOMAIN": "",
"DEFAULT_ACL": None,
},
}

Expand Down

0 comments on commit 3f31991

Please sign in to comment.