Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Drop BOPS_SUBMISSION_URL_* env vars in favour of DB values #2504

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 0 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ PRODUCTION_PG_URL_FOR_USER_GITHUB_ACTIONS=👻
SHAREDB_PORT=7003

# Integrations (local and pull request environments point to third party staging environments)
BOPS_API_ROOT_DOMAIN=👻
BOPS_API_TOKEN=👻

GOVUK_NOTIFY_API_KEY=👻
Expand All @@ -88,26 +87,16 @@ SUPPRESS_LOGS=true
## Lambeth
GOV_UK_PAY_TOKEN_LAMBETH=👻
UNIFORM_CLIENT_LAMBETH=👻
BOPS_SUBMISSION_URL_LAMBETH=https://lambeth.${BOPS_API_ROOT_DOMAIN}

## Southwark
GOV_UK_PAY_TOKEN_SOUTHWARK=👻
UNIFORM_CLIENT_SOUTHWARK=👻
BOPS_SUBMISSION_URL_SOUTHWARK=https://southwark.${BOPS_API_ROOT_DOMAIN}

## Buckinghamshire
GOV_UK_PAY_TOKEN_BUCKINGHAMSHIRE=👻
UNIFORM_CLIENT_AYLESBURY_VALE=👻
UNIFORM_CLIENT_CHILTERN=👻
UNIFORM_CLIENT_WYCOMBE=👻
BOPS_SUBMISSION_URL_BUCKINGHAMSHIRE=https://buckinghamshire.${BOPS_API_ROOT_DOMAIN}

## Camden
BOPS_SUBMISSION_URL_CAMDEN=https://camden.${BOPS_API_ROOT_DOMAIN}

## Gloucester
BOPS_SUBMISSION_URL_GLOUCESTER=https://gloucester.${BOPS_API_ROOT_DOMAIN}

## End-to-end test team (borrows Lambeth's details)
GOV_UK_PAY_TOKEN_E2E=👻
BOPS_SUBMISSION_URL_E2E=https://lambeth.${BOPS_API_ROOT_DOMAIN}
12 changes: 1 addition & 11 deletions api.planx.uk/.env.test.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ HASURA_GRAPHQL_URL=http://hasura:8080/v1/graphql
HASURA_PLANX_API_KEY=👻

# Integrations
BOPS_API_ROOT_DOMAIN=👻
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This env var can also be tidied up 🗑️

Copy link
Member

Choose a reason for hiding this comment

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

Very satisfying ✂️

BOPS_API_TOKEN=👻

GOV_UK_PAY_TOKEN_BUCKINGHAMSHIRE=👻
Expand All @@ -41,18 +40,9 @@ SLACK_WEBHOOK_URL=👻
# Local authority specific integrations
## Lambeth
GOV_UK_PAY_TOKEN_LAMBETH=👻
BOPS_SUBMISSION_URL_LAMBETH=https://lambeth.${BOPS_API_ROOT_DOMAIN}

## Southwark
GOV_UK_PAY_TOKEN_SOUTHWARK=👻
BOPS_SUBMISSION_URL_SOUTHWARK=https://southwark.${BOPS_API_ROOT_DOMAIN}

## Buckinghamshire
GOV_UK_PAY_TOKEN_BUCKINGHAMSHIRE=👻
BOPS_SUBMISSION_URL_BUCKINGHAMSHIRE=https://buckinghamshire.${BOPS_API_ROOT_DOMAIN}

## Camden
BOPS_SUBMISSION_URL_CAMDEN=https://camden.${BOPS_API_ROOT_DOMAIN}

## Gloucester
BOPS_SUBMISSION_URL_GLOUCESTER=https://gloucester.${BOPS_API_ROOT_DOMAIN}
GOV_UK_PAY_TOKEN_BUCKINGHAMSHIRE=👻
36 changes: 34 additions & 2 deletions api.planx.uk/modules/send/bops/bops.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jest.mock("@opensystemslab/planx-core", () => {
};
});

const submissionURL = process.env.BOPS_SUBMISSION_URL_SOUTHWARK;

describe(`sending an application to BOPS`, () => {
const submissionURL = "https://test.bops-test.com";

beforeEach(() => {
queryMock.mockQuery({
name: "FindApplication",
Expand All @@ -46,6 +46,38 @@ describe(`sending an application to BOPS`, () => {
insertBopsApplication: { id: 22 },
},
});

queryMock.mockQuery({
name: "GetStagingBopsSubmissionURL",
data: {
teams: [
{
integrations: {
bopsSubmissionURL: submissionURL,
},
},
],
},
variables: {
slug: "southwark",
},
});

queryMock.mockQuery({
name: "GetStagingBopsSubmissionURL",
data: {
teams: [
{
integrations: {
bopsSubmissionURL: null,
},
},
],
},
variables: {
slug: "unsupported-team",
},
});
});

it("proxies request and returns hasura id", async () => {
Expand Down
7 changes: 5 additions & 2 deletions api.planx.uk/modules/send/bops/bops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ const sendToBOPS = async (req: Request, res: Response, next: NextFunction) => {
// a local or staging API instance should send to the BOPS staging endpoint
// production should send to the BOPS production endpoint
const localAuthority = req.params.localAuthority;
const bopsSubmissionURLEnvName = `BOPS_SUBMISSION_URL_${localAuthority.toUpperCase()}`;
const bopsSubmissionURL = process.env[bopsSubmissionURLEnvName];
const env = process.env.NODE_ENV === "production" ? "production" : "staging";
const bopsSubmissionURL = await $api.team.getBopsSubmissionURL(
localAuthority,
env,
);
const isSupported = Boolean(bopsSubmissionURL);
if (!isSupported) {
return next(
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@airbrake/node": "^2.1.8",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#d38a7d3",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#e19754f",
"@types/isomorphic-fetch": "^0.0.36",
"adm-zip": "^0.5.10",
"aws-sdk": "^2.1467.0",
Expand Down
14 changes: 5 additions & 9 deletions api.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions api.planx.uk/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ app.use(helmet());
assert(process.env.GOVUK_NOTIFY_API_KEY);
assert(process.env.HASURA_PLANX_API_KEY);
assert(process.env.BOPS_API_TOKEN);
assert(process.env.BOPS_SUBMISSION_URL_LAMBETH);
assert(process.env.BOPS_SUBMISSION_URL_BUCKINGHAMSHIRE);
assert(process.env.BOPS_SUBMISSION_URL_SOUTHWARK);
assert(process.env.BOPS_SUBMISSION_URL_CAMDEN);
assert(process.env.BOPS_SUBMISSION_URL_GLOUCESTER);
assert(process.env.UNIFORM_TOKEN_URL);
assert(process.env.UNIFORM_SUBMISSION_URL);

Expand Down
3 changes: 1 addition & 2 deletions docker-compose.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ services:
UNIFORM_SUBMISSION_URL: http://mock-server:8080
UNIFORM_TOKEN_URL: http://mock-server:8080
UNIFORM_CLIENT_E2E: e2e:123
GOV_UK_PAY_TOKEN_E2E: ${GOV_UK_PAY_TOKEN_E2E}
BOPS_SUBMISSION_URL_E2E: http://mock-server:8080
GOV_UK_PAY_TOKEN_E2E: ${GOV_UK_PAY_TOKEN_E2E}
7 changes: 0 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,14 @@ services:
# Lambeth
GOV_UK_PAY_TOKEN_LAMBETH: ${GOV_UK_PAY_TOKEN_LAMBETH}
UNIFORM_CLIENT_LAMBETH: ${UNIFORM_CLIENT_LAMBETH}
BOPS_SUBMISSION_URL_LAMBETH: ${BOPS_SUBMISSION_URL_LAMBETH}
# Southwark
GOV_UK_PAY_TOKEN_SOUTHWARK: ${GOV_UK_PAY_TOKEN_SOUTHWARK}
UNIFORM_CLIENT_SOUTHWARK: ${UNIFORM_CLIENT_SOUTHWARK}
BOPS_SUBMISSION_URL_SOUTHWARK: ${BOPS_SUBMISSION_URL_SOUTHWARK}
# Buckinghamshire
GOV_UK_PAY_TOKEN_BUCKINGHAMSHIRE: ${GOV_UK_PAY_TOKEN_BUCKINGHAMSHIRE}
UNIFORM_CLIENT_AYLESBURY_VALE: ${UNIFORM_CLIENT_AYLESBURY_VALE}
UNIFORM_CLIENT_CHILTERN: ${UNIFORM_CLIENT_CHILTERN}
UNIFORM_CLIENT_WYCOMBE: ${UNIFORM_CLIENT_WYCOMBE}
BOPS_SUBMISSION_URL_BUCKINGHAMSHIRE: ${BOPS_SUBMISSION_URL_BUCKINGHAMSHIRE}
# Camden
BOPS_SUBMISSION_URL_CAMDEN: ${BOPS_SUBMISSION_URL_CAMDEN}
# Gloucester
BOPS_SUBMISSION_URL_GLOUCESTER: ${BOPS_SUBMISSION_URL_GLOUCESTER}

sharedb:
restart: unless-stopped
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"@cucumber/cucumber": "^9.3.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#d38a7d3",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#e19754f",
"axios": "^1.6.0",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
14 changes: 5 additions & 9 deletions e2e/tests/api-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions e2e/tests/api-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export async function cleanup({

export const setup = async () => {
await setUpMocks();
// TODO: Setup team_integrations
const world = {
teamId: await createTeam(),
userId: await createUser(),
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "./install-dependencies.sh"
},
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#d38a7d3",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#e19754f",
"axios": "^1.6.0",
"dotenv": "^16.3.1",
"eslint": "^8.44.0",
Expand Down
14 changes: 5 additions & 9 deletions e2e/tests/ui-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@mui/styles": "^5.14.5",
"@mui/utils": "^5.14.5",
"@opensystemslab/map": "^0.7.5",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#d38a7d3",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#e19754f",
"@tiptap/core": "^2.0.3",
"@tiptap/extension-bold": "^2.0.3",
"@tiptap/extension-bubble-menu": "^2.1.6",
Expand Down
10 changes: 5 additions & 5 deletions editor.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion infrastructure/application/Pulumi.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ config:
secure: AAABAE+ZtQZO26XlmfAS7tG1DkwQ+G5OP82Roe4EOuk/tG1bMsI=
application:airbrake-project-key:
secure: AAABAPIGB+gWevPn0SzWnuSuV1RmdwpLOlWKnu8cM/kxLfslvdCIRcU0n0M0XNJ3jwj4EdFn7/llsL1Kg2XnDA==
application:bops-api-root-domain: bops.services
application:bops-api-token:
secure: AAABALRtSjQMRjERtkHs6WBOI7MBMw4bFOuHO8qLLPe9Pfg8Nlbp61XalZA1pmXsRt/T+59fGcdqbKA5WRkOZVibhFo=
application:cloudflare-zone-id: a9b9933f28e786ec4cfd4bb596f5a519
Expand Down
1 change: 0 additions & 1 deletion infrastructure/application/Pulumi.sandbox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ config:
application:airbrake-project-id: "329753"
application:airbrake-project-key:
secure: AAABAO8NgmVNdkwajWpiKwi+dxGicFACbAQzK66FREUCp+OUbSRyNAb9dSQHq/n9fZb8xWBdvYBCQ9eBr2jqPQ==
application:bops-api-root-domain: bops-staging.services
application:bops-api-token:
secure: AAABAHLQf7CFOK073geL2TbTYycQCzPYUy3Xi66UniwIrTlOAqve2YBikJXzMJ2xS9v4dGUZMUmwUba0OpTz8KAMXJ8=
application:cloudflare-zone-id: 9cdfc35484748e96b0ed2b1d303a694f
Expand Down
1 change: 0 additions & 1 deletion infrastructure/application/Pulumi.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ config:
secure: AAABABxcp8r3CZAw1kXuXkwPZ8cKRDQyOg4+gVvqzKuCFWb8BEU=
application:airbrake-project-key:
secure: AAABABujxMHxU8Abj4QpyQTz7bLt3AP2wBFaypVkDZ2khzc6eh6lHLljTEkzpLUncno3gNNDXnrmxzXvqKnQdQ==
application:bops-api-root-domain: bops-staging.services
application:bops-api-token:
secure: AAABAJx2KnnFeuEmwRB5VyE790TeYxiKmWFuVXVY8Lb7+HDNRYND8Pfd9d61zjwPzi9Jf2ZlT0OH++1MXYafhdQO28Y=
application:cloudflare-zone-id:
Expand Down
Loading
Loading