From 70f1372b11f84b1c8580a3d8ab85355e586df67b Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:06:10 +0000 Subject: [PATCH] chore: setup power automate api keys for Medway (#4078) --- .env.example | 1 + api.planx.uk/.env.test.example | 1 + api.planx.uk/modules/auth/middleware.ts | 4 ++++ docker-compose.yml | 1 + infrastructure/application/Pulumi.production.yaml | 2 ++ infrastructure/application/Pulumi.staging.yaml | 2 ++ infrastructure/application/index.ts | 4 ++++ 7 files changed, 15 insertions(+) diff --git a/.env.example b/.env.example index 766aa593e0..759d790a91 100644 --- a/.env.example +++ b/.env.example @@ -33,6 +33,7 @@ FILE_API_KEY_BARNET=👻 FILE_API_KEY_LAMBETH=👻 FILE_API_KEY_SOUTHWARK=👻 FILE_API_KEY_EPSOM_EWELL=👻 +FILE_API_KEY_MEDWAY=👻 # Editor EDITOR_URL_EXT=http://localhost:3000 diff --git a/api.planx.uk/.env.test.example b/api.planx.uk/.env.test.example index 4df97c1b50..bdc74b375e 100644 --- a/api.planx.uk/.env.test.example +++ b/api.planx.uk/.env.test.example @@ -23,6 +23,7 @@ FILE_API_KEY_BARNET=👻 FILE_API_KEY_LAMBETH=👻 FILE_API_KEY_SOUTHWARK=👻 FILE_API_KEY_EPSOM_EWELL=👻 +FILE_API_KEY_MEDWAY=👻 # Editor EDITOR_URL_EXT=example.com diff --git a/api.planx.uk/modules/auth/middleware.ts b/api.planx.uk/modules/auth/middleware.ts index d831e9a557..5b4cdfc9d3 100644 --- a/api.planx.uk/modules/auth/middleware.ts +++ b/api.planx.uk/modules/auth/middleware.ts @@ -99,6 +99,10 @@ export const useFilePermission: RequestHandler = (req, _res, next): void => { req.headers["api-key"] as string, process.env.FILE_API_KEY_SOUTHWARK!, ) || + isEqual( + req.headers["api-key"] as string, + process.env.FILE_API_KEY_MEDWAY!, + ) || isEqual( req.headers["api-key"] as string, process.env.FILE_API_KEY_EPSOM_EWELL!, diff --git a/docker-compose.yml b/docker-compose.yml index 34a4c69e8d..b045c55b3d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -128,6 +128,7 @@ services: FILE_API_KEY_LAMBETH: ${FILE_API_KEY_LAMBETH} FILE_API_KEY_SOUTHWARK: ${FILE_API_KEY_SOUTHWARK} FILE_API_KEY_EPSOM_EWELL: ${FILE_API_KEY_EPSOM_EWELL} + FILE_API_KEY_MEDWAY: ${FILE_API_KEY_MEDWAY} FILE_API_KEY_NEXUS: ${FILE_API_KEY_NEXUS} FILE_API_KEY: ${FILE_API_KEY} GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID} diff --git a/infrastructure/application/Pulumi.production.yaml b/infrastructure/application/Pulumi.production.yaml index 422e043c3d..6aba6b28c2 100644 --- a/infrastructure/application/Pulumi.production.yaml +++ b/infrastructure/application/Pulumi.production.yaml @@ -14,6 +14,8 @@ config: secure: AAABANvwhiVRBq8NH7ZqcToUzYn4X+KfC5Wm8WjWUKXT5TuVXqC6zHhVVKFBbmdtKjC4j5M4+bWsLiFO9dO0MLobxLpK7YCE application:file-api-key-lambeth: secure: AAABAMNhdCTlFx3fZH/nO71ildypZB2JR5NixlQCENsS1VqwdiOX17q/Gi1UFrCQi2qaY2sZFG4= + application:file-api-key-medway: + secure: AAABABXSnk3j06JukiZ2u/me+pnRjHWAm+rf9FW9bSmzMfr9SWSKyN4XlltOYv1iZKujgI9hGIGiVR40+uYjGjy7BwNqOFxI application:file-api-key-nexus: secure: AAABAB2cv4GAf8RqN1hHbRbO68p8o4kLJYWsip9BoPdobrNtQB787M3s+gJnKKl9DfyXRHOXHGc= application:file-api-key-southwark: diff --git a/infrastructure/application/Pulumi.staging.yaml b/infrastructure/application/Pulumi.staging.yaml index 5463a157ba..49df40ad99 100644 --- a/infrastructure/application/Pulumi.staging.yaml +++ b/infrastructure/application/Pulumi.staging.yaml @@ -15,6 +15,8 @@ config: secure: AAABAD1/nlJ2EOEglLiiNsOLbOd3KWCONhNhJAIdZQVnrSRsNIzX2luszOreQf20EYl8AZ4L1TiheqUHSt22e5z1FiLWoCtY application:file-api-key-lambeth: secure: AAABALQTeIf/uScxASJkhmoPRhewQT94Guad4iJ7GRk0DcND8wDUG0eNxDU4+XwUQZqCnL2DP+E= + application:file-api-key-medway: + secure: AAABABCpSTmTDJU81pG7U57Igr4OtBbX6VuqRooq9Ipzoq1peTenbNQYBWacZn6lyg7ceLAgbiHQgT7LqX2tKN1QwON/BSQh application:file-api-key-nexus: secure: AAABAJFgaBoTWNmZyXDkGRngwU8KpOt6CeBLxGBgBG0JFMsKK7rWT39TsjJ9pL1wZaBoT0YZhCg= application:file-api-key-southwark: diff --git a/infrastructure/application/index.ts b/infrastructure/application/index.ts index f6e978a5cb..a4754a1ab5 100644 --- a/infrastructure/application/index.ts +++ b/infrastructure/application/index.ts @@ -373,6 +373,10 @@ export = async () => { name: "FILE_API_KEY_EPSOM_EWELL", value: config.requireSecret("file-api-key-epsom-ewell"), }, + { + name: "FILE_API_KEY_MEDWAY", + value: config.requireSecret("file-api-key-medway"), + }, { name: "GOOGLE_CLIENT_ID", value: config.require("google-client-id"),