Skip to content

Commit fe2d660

Browse files
committed
fix: aws env vars
1 parent 55c41a3 commit fe2d660

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

codeforlife/settings/third_party.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
from .custom import SERVICE_NAME, SERVICE_SITE_URL
1212
from .django import ENV
13-
from .otp import AWS_REGION, SQS_URL
13+
from .otp import AWS_REGION as OTP_AWS_REGION
14+
from .otp import SQS_URL
1415

1516
if t.TYPE_CHECKING:
1617
from ..tasks import CeleryBeatSchedule
@@ -37,20 +38,30 @@
3738
"NON_FIELD_ERRORS_KEY": "__all__",
3839
}
3940

41+
# AWS CLI
42+
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
43+
# NOTE: These are set in the dev container:
44+
# https://github.com/ocadotechnology/codeforlife-workspace/blob/main/.devcontainer/docker-compose.yml
45+
46+
AWS_REGION = os.getenv("AWS_REGION", "us-east-1")
47+
AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID", "test")
48+
AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY", "test")
49+
AWS_ENDPOINT_URL = os.getenv("AWS_ENDPOINT_URL", "http://aws:4566")
50+
4051
# Celery
4152
# https://docs.celeryq.dev/en/v5.4.0/userguide/configuration.html
4253
# https://docs.celeryq.dev/en/v5.4.0/getting-started/backends-and-brokers/sqs.html
4354

4455
CELERY_BROKER_URL = "sqs://"
4556
CELERY_BROKER_TRANSPORT_OPTIONS = {
46-
"region": AWS_REGION if ENV != "local" else os.environ["AWS_REGION"],
57+
"region": OTP_AWS_REGION if ENV != "local" else AWS_REGION,
4758
"predefined_queues": {
4859
SERVICE_NAME: {
4960
"url": (
5061
SQS_URL
5162
if ENV != "local"
5263
else (
53-
"http://sqs.us-east-1.localhost.localstack.cloud:4566"
64+
f"http://sqs.{AWS_REGION}.localhost.localstack.cloud:4566"
5465
f"/000000000000/{SERVICE_NAME}"
5566
)
5667
)

0 commit comments

Comments
 (0)