Skip to content

Commit ed0307e

Browse files
committed
Set internal dev server & modify when mtls is set
Signed-off-by: Connor Avery <[email protected]>
1 parent aa755bb commit ed0307e

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

.github/scripts/deploy_api.sh

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,31 @@ echo "Retrieving proxygen credentials"
9797
# Retrieve the proxygen private key and client private key and cert from AWS Secrets Manager
9898
proxygen_private_key_arn=$(aws cloudformation list-exports --query "Exports[?Name=='secrets:${PROXYGEN_PRIVATE_KEY_NAME}'].Value" --output text)
9999

100+
echo
101+
echo "Deploy the API instance using Proxygen proxy lambda"
102+
if [[ "${DRY_RUN}" == "false" ]]; then
103+
104+
jq -n --argfile spec "${SPEC_PATH}" \
105+
--arg apiName "${apigee_api}" \
106+
--arg apiClient "${apigee_client}" \
107+
--arg environment "${APIGEE_ENVIRONMENT}" \
108+
--arg instance "${instance}" \
109+
--arg kid "${PROXYGEN_KID}" \
110+
--arg proxygenSecretName "${proxygen_private_key_arn}" \
111+
'{apiName: $apiName, apiClient: $apiClient, environment: $environment, specDefinition: $spec, instance: $instance, kid: $kid, proxygenSecretName: $proxygenSecretName}' > payload.json
112+
113+
aws lambda invoke --function-name "${instance_put_lambda}" --cli-binary-format raw-in-base64-out --payload file://payload.json out.txt > response.json
114+
115+
if eval "cat response.json | jq -e '.FunctionError' >/dev/null"; then
116+
echo 'Error calling lambda'
117+
cat out.txt
118+
exit 1
119+
fi
120+
echo "Instance deployed"
121+
else
122+
echo "Would call ${instance_put_lambda}"
123+
fi
124+
100125
if [[ "${ENABLE_MUTUAL_TLS}" == "true" ]]; then
101126
echo
102127
echo "Store the secret used for mutual TLS to AWS using Proxygen proxy lambda"
@@ -123,31 +148,6 @@ if [[ "${ENABLE_MUTUAL_TLS}" == "true" ]]; then
123148
fi
124149
fi
125150

126-
echo
127-
echo "Deploy the API instance using Proxygen proxy lambda"
128-
if [[ "${DRY_RUN}" == "false" ]]; then
129-
130-
jq -n --argfile spec "${SPEC_PATH}" \
131-
--arg apiName "${apigee_api}" \
132-
--arg apiClient "${apigee_client}" \
133-
--arg environment "${APIGEE_ENVIRONMENT}" \
134-
--arg instance "${instance}" \
135-
--arg kid "${PROXYGEN_KID}" \
136-
--arg proxygenSecretName "${proxygen_private_key_arn}" \
137-
'{apiName: $apiName, apiClient: $apiClient, environment: $environment, specDefinition: $spec, instance: $instance, kid: $kid, proxygenSecretName: $proxygenSecretName}' > payload.json
138-
139-
aws lambda invoke --function-name "${instance_put_lambda}" --cli-binary-format raw-in-base64-out --payload file://payload.json out.txt > response.json
140-
141-
if eval "cat response.json | jq -e '.FunctionError' >/dev/null"; then
142-
echo 'Error calling lambda'
143-
cat out.txt
144-
exit 1
145-
fi
146-
echo "Instance deployed"
147-
else
148-
echo "Would call ${instance_put_lambda}"
149-
fi
150-
151151
# if [[ "${APIGEE_ENVIRONMENT}" == "int" ]]; then
152152
# echo
153153
# echo "Deploy the API spec to prod catalogue as it is int environment"

packages/specification/prescriptions-for-patients.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ x-spec-publication:
102102
path: /Bundle
103103

104104
servers:
105+
- url: https://internal-dev.api.service.nhs.uk/prescriptions-for-patients
106+
description: Internal Dev
105107
- url: "https://sandbox.api.service.nhs.uk/prescriptions-for-patients"
106108
description: Sandbox
107109
- url: "https://int.api.service.nhs.uk/prescriptions-for-patients"

0 commit comments

Comments
 (0)