Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
3 changes: 1 addition & 2 deletions lambdas/mns_publisher/src/process_records.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import os
from typing import Tuple

from aws_lambda_typing.events.sqs import SQSMessage

Expand Down Expand Up @@ -68,7 +67,7 @@ def process_record(record: SQSMessage, mns_service: MnsService | MockMnsService)
logger.info("Successfully created MNS notification", extra={"mns_notification_id": notification_id})


def extract_trace_ids(record: SQSMessage) -> Tuple[str, str | None]:
def extract_trace_ids(record: SQSMessage) -> tuple[str, str | None]:
"""
Extract identifiers for tracing from SQS record.
Returns: Tuple of (message_id, immunisation_id)
Expand Down
2 changes: 1 addition & 1 deletion lambdas/mns_publisher/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def load_sample_sqs_event() -> dict:
Expects: lambdas/mns_publisher/tests/sqs_event.json
"""
sample_event_path = Path(__file__).parent / "sample_data" / "sqs_event.json"
with open(sample_event_path, "r") as f:
with open(sample_event_path) as f:
raw_event = json.load(f)

if isinstance(raw_event.get("body"), dict):
Expand Down
2 changes: 1 addition & 1 deletion lambdas/shared/src/common/api_clients/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, service: Service, secret_manager_client, environment, cache:

self.expiry = 30
self.secret_name = (
f"imms/pds/{environment}/jwt-secrets"
f"imms/outbound/{environment}/jwt-secrets"
Comment thread
dlzhry2nhs marked this conversation as resolved.
Outdated
if service == Service.PDS
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct - isnt environment int only, not dev etc?
Please correct me if I'm wrong, I thought we have the same secret name for int and dev?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we have set the environment variables for all our external api clients in terraform tf.vars and it would either only be int for dev and preprod environment or prod for prod environment. so this {environment} here is passed as a parameter that is derived whenever AppRestrictedAuth is instantiated either through mns or pds.

else f"imms/immunization/{environment}/jwt-secrets"
)
Expand Down
6 changes: 2 additions & 4 deletions lambdas/shared/src/common/get_service_url.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from typing import Optional

from common.constants import DEFAULT_BASE_PATH, PR_ENV_PREFIX


def get_service_url(service_env: Optional[str], service_base_path: Optional[str]) -> str:
def get_service_url(service_env: str | None, service_base_path: str | None) -> str:
"""Sets the service URL based on service parameters derived from env vars. PR environments use internal-dev while
we also default to this environment. The only other exceptions are preprod which maps to the Apigee int environment
and prod which does not have a subdomain."""
Expand All @@ -22,5 +20,5 @@ def get_service_url(service_env: Optional[str], service_base_path: Optional[str]
return f"https://{subdomain}api.service.nhs.uk/{service_base_path}"


def is_pr_env(service_env: Optional[str]) -> bool:
def is_pr_env(service_env: str | None) -> bool:
return service_env is not None and service_env.startswith(PR_ENV_PREFIX)
Loading