From d9931f8de5ab79d8392d3b267855ea4b3bbca862 Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Wed, 28 Jun 2023 20:08:59 +1200 Subject: [PATCH] chore: Remove leftover AWS configuration --- docker/Dockerfile | 2 +- ietf/settings/docker/grains/aws.py | 49 ------------------------------ ietf/settings/docker/hosting.py | 6 ---- 3 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 ietf/settings/docker/grains/aws.py delete mode 100644 ietf/settings/docker/hosting.py diff --git a/docker/Dockerfile b/docker/Dockerfile index ff330548..cdccf333 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -64,7 +64,7 @@ COPY --from=frontend /app/ /app/ ARG VERSION=dev ENV APPLICATION_VERSION=${VERSION} -ENV DJANGO_SETTINGS_MODULE ietf.settings.docker.hosting +ENV DJANGO_SETTINGS_MODULE ietf.settings.docker.base ENV VERSION=${VERSION} ENV ENVIRONMENT unknown ENV PROJECT wagtail_website diff --git a/ietf/settings/docker/grains/aws.py b/ietf/settings/docker/grains/aws.py deleted file mode 100644 index e618b2b5..00000000 --- a/ietf/settings/docker/grains/aws.py +++ /dev/null @@ -1,49 +0,0 @@ -import requests - -from django.core.exceptions import ImproperlyConfigured - -from .. import AWS_S3_CUSTOM_DOMAIN, AWS_STORAGE_BUCKET_NAME, ALLOWED_HOSTS - - -def _probe_aws_ip(): - try: - ec2_private_ip = requests.get( - "http://169.254.169.254/latest/meta-data/local-ipv4", timeout=3 - ).text - except requests.exceptions.RequestException as e: - raise ValueError("Could not get EC2 private ip address: {}".format(e)) - else: - if not ec2_private_ip: - raise ValueError( - "Could not get EC2 private ip address: ec2_private_ip={!r}".format( - ec2_private_ip - ) - ) - return ec2_private_ip - - -ALLOWED_HOSTS.append(_probe_aws_ip()) - -AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "public, max-age=900"} -AWS_DEFAULT_ACL = None -# #S3 settings -DEFAULT_FILE_STORAGE = "ietf.s3utils.MediaRootS3BotoStorage" -THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE -STATICFILES_STORAGE = "ietf.s3utils.StaticRootS3BotoStorage" - -if not AWS_STORAGE_BUCKET_NAME: - raise ImproperlyConfigured( - "Wrong AWS_STORAGE_BUCKET_NAME={!r} env variable".format( - AWS_STORAGE_BUCKET_NAME - ) - ) - -if not AWS_S3_CUSTOM_DOMAIN: - AWS_S3_CUSTOM_DOMAIN = "{}.s3-ap-southeast-2.amazonaws.com".format( - AWS_STORAGE_BUCKET_NAME - ) - -STATIC_URL = "https://%s/static/" % AWS_S3_CUSTOM_DOMAIN -MEDIA_URL = "https://%s/media/" % AWS_S3_CUSTOM_DOMAIN - -AWS_S3_FILE_OVERWRITE = False diff --git a/ietf/settings/docker/hosting.py b/ietf/settings/docker/hosting.py deleted file mode 100644 index c954d86d..00000000 --- a/ietf/settings/docker/hosting.py +++ /dev/null @@ -1,6 +0,0 @@ -from .base import * - -from .grains.aws import * - -SECURE_HSTS_SECONDS = 31536000 -CACHE_MIDDLEWARE_ALIAS = "dummy" # Remove after upgrade to Wagtail >= 2.10. See https://github.com/wagtail/wagtail/issues/5975