|
10 | 10 |
|
11 | 11 | from .custom import SERVICE_NAME, SERVICE_SITE_URL |
12 | 12 | 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 |
14 | 15 |
|
15 | 16 | if t.TYPE_CHECKING: |
16 | 17 | from ..tasks import CeleryBeatSchedule |
|
37 | 38 | "NON_FIELD_ERRORS_KEY": "__all__", |
38 | 39 | } |
39 | 40 |
|
| 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 | + |
40 | 51 | # Celery |
41 | 52 | # https://docs.celeryq.dev/en/v5.4.0/userguide/configuration.html |
42 | 53 | # https://docs.celeryq.dev/en/v5.4.0/getting-started/backends-and-brokers/sqs.html |
43 | 54 |
|
44 | 55 | CELERY_BROKER_URL = "sqs://" |
45 | 56 | 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, |
47 | 58 | "predefined_queues": { |
48 | 59 | SERVICE_NAME: { |
49 | 60 | "url": ( |
50 | 61 | SQS_URL |
51 | 62 | if ENV != "local" |
52 | 63 | else ( |
53 | | - "http://sqs.us-east-1.localhost.localstack.cloud:4566" |
| 64 | + f"http://sqs.{AWS_REGION}.localhost.localstack.cloud:4566" |
54 | 65 | f"/000000000000/{SERVICE_NAME}" |
55 | 66 | ) |
56 | 67 | ) |
|
0 commit comments