Repository: bookwyrm-social/bookwyrm

Issue:
AWS_S3_CUSTOM_DOMAIN not set error for Amazon S3 Buckets
**Describe the bug**
According to the documentation ( https://docs.joinbookwyrm.com/external-storage.html ), Custom domain doesn't need to be set for Amazon S3 buckets. So I didn't.

**To Reproduce**
Steps to reproduce the behavior:
Running the following command
`venv/bin/python3 manage.py collectstatic --no-input`

gives the following error

```
Traceback (most recent call last):
  File "/opt/bookwyrm/manage.py", line 18, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/bookwyrm/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/bookwyrm/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 363, in execute
    settings.INSTALLED_APPS
  File "/opt/bookwyrm/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/opt/bookwyrm/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 69, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/bookwyrm/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 170, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/bookwyrm/bookwyrm/settings.py", line 359, in <module>
    AWS_S3_CUSTOM_DOMAIN = env("AWS_S3_CUSTOM_DOMAIN")
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/bookwyrm/venv/lib/python3.11/site-packages/environs/__init__.py", line 116, in method
    raise EnvError('Environment variable "{}" not set'.format(proxied_key or parsed_key))
environs.EnvError: Environment variable "AWS_S3_CUSTOM_DOMAIN" not set

```
**Expected behavior**
The command should run successfully.

---

BookWyrm 0.6.5
Debian 12
Python 3.11.2


Discussion:
And if you set the custom domain name, it asks for AWS_S3_ENDPOINT_URL as well with the same error message.
@navjotjsingh sounds like maybe the docs are not quite correct. What happens if you set both of those values to `None` or `""`?

Resolving patch:
diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py
--- a/bookwyrm/settings.py
+++ b/bookwyrm/settings.py
@@ -366,9 +366,9 @@
     AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID")
     AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY")
     AWS_STORAGE_BUCKET_NAME = env("AWS_STORAGE_BUCKET_NAME")
-    AWS_S3_CUSTOM_DOMAIN = env("AWS_S3_CUSTOM_DOMAIN")
+    AWS_S3_CUSTOM_DOMAIN = env("AWS_S3_CUSTOM_DOMAIN", None)
     AWS_S3_REGION_NAME = env("AWS_S3_REGION_NAME", "")
-    AWS_S3_ENDPOINT_URL = env("AWS_S3_ENDPOINT_URL")
+    AWS_S3_ENDPOINT_URL = env("AWS_S3_ENDPOINT_URL", None)
     AWS_DEFAULT_ACL = "public-read"
     AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "max-age=86400"}
     # S3 Static settings


Test patch: