Skip to content

Commit

Permalink
fix: logical error with assigning gov pay secret (#2709)
Browse files Browse the repository at this point in the history
Co-authored-by: Dafydd Llŷr Pearson <[email protected]>
  • Loading branch information
Mike-Heneghan and DafyddLlyr authored Jan 26, 2024
1 parent 2bc7b7b commit 6a2933a
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions infrastructure/application/utils/generateTeamSecrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,27 @@ export const generateTeamSecrets = (
): awsx.ecs.KeyValuePair[] => {
const secrets: awsx.ecs.KeyValuePair[] = [];
teams.forEach((team) => {
if (team?.govPayStagingOnly && env !== "production") {
secrets.push({
name: `GOV_UK_PAY_TOKEN_${name(team.name)}`,
value:
env === "sandbox"
? "sandbox"
: config.require(`gov-uk-pay-token-${value(team.name)}`),
});
}
switch(env) {
case "sandbox":
secrets.push({
name: `GOV_UK_PAY_TOKEN_${name(team.name)}`,
value: "sandbox"
});
break;
case "staging":
secrets.push({
name: `GOV_UK_PAY_TOKEN_${name(team.name)}`,
value: config.require(`gov-uk-pay-token-${value(team.name)}`),
});
break;
case "production":
if (!team?.govPayStagingOnly) {
secrets.push({
name: `GOV_UK_PAY_TOKEN_${name(team.name)}`,
value: config.require(`gov-uk-pay-token-${value(team.name)}`),
});
}
};
team.uniformInstances?.forEach((instance) => {
secrets.push({
name: `UNIFORM_CLIENT_${name(instance)}`,
Expand Down

0 comments on commit 6a2933a

Please sign in to comment.