Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
AppIsBehindCloudFront=True \
AppLogRetentionDays=60 \
DCEnvironment=$DC_ENVIRONMENT \

AppDomain='$PUBLIC_FQDN' \
"

- run:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ lambda-layers/FrontendDependenciesLayer/requirements.txt: Pipfile Pipfile.lock #

.PHONY: aggregator/apps/api_docs/v1/templates/api_docs_rendered.html
aggregator/apps/api_docs/v1/templates/api_docs_rendered.html: ## Rebuild the API documentation page
PIPELINE_ENABLED=True python manage.py build_docs
PIPELINE_ENABLED=True APP_DOMAIN=localhost python manage.py build_docs

.PHONY: help
# gratuitously adapted from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
Expand Down
18 changes: 15 additions & 3 deletions frontend/settings/base_lambda.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import os

from boto3 import Session
import boto3

from .base import * # noqa

ALLOWED_HOSTS = ["*"]

def get_api_gateway_urls():
client = boto3.client("apigateway")
response = client.get_rest_apis()
return [
f"{api['id']}.execute-api.eu-west-2.amazonaws.com"
for api in response["items"]
if api["name"].startswith("AggregatorApiApp-")
]


ALLOWED_HOSTS = [os.environ.get("APP_DOMAIN")]
DEBUG = os.environ.get("DEBUG", False)

WHITENOISE_AUTOREFRESH = False
Expand Down Expand Up @@ -71,7 +82,8 @@
)

if os.environ.get("AWS_EXECUTION_ENV"):
logger_boto3_session = Session(region_name="eu-west-2")
ALLOWED_HOSTS = ALLOWED_HOSTS + get_api_gateway_urls()
logger_boto3_session = boto3.Session(region_name="eu-west-2")

LOGGING = {
"version": 1,
Expand Down
5 changes: 5 additions & 0 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Parameters:
Default: AppDebug
Type: AWS::SSM::Parameter::Value<String>

AppDomain:
Description: "The domain the app is on."
Type: String

AppSentryDSN:
Description: "The SENTRY_DSN environment variable passed to the app."
Type: String
Expand Down Expand Up @@ -322,6 +326,7 @@ Resources:
SMTP_HOST: !Ref AppSmtpHost
SMTP_USERNAME: !Ref AppSmtpUser
SMTP_PASSWORD: !Ref AppSmtpPass
APP_DOMAIN: !Ref AppDomain
Events:
HTTPRequests:
Type: Api
Expand Down