Skip to content

Commit

Permalink
Add route /build/scalingo/restart-review-app
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuGilet committed Dec 7, 2023
1 parent 04c6b64 commit e6ec400
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
28 changes: 28 additions & 0 deletions build/controllers/scalingo.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,32 @@ module.exports = {

return 'Slack error notification sent';
},
async restartReviewApp(request) {
logger.info({
event: 'restart-review-app',
message: 'Restart review app request received',
});

logger.info({
event: 'restart-review-app',
message: JSON.stringify(request.payload),
});

if (request.payload?.type_data?.metric !== 'Requests per Minute') {
logger.error({
event: 'restart-review-app',
message: `Not managed metric ${request.payload?.type_data?.metric}`,
});
return;
}

const { app_name: appName, app_id: appId } = request.payload;

logger.info({
event: 'restart-review-app',
message: `Starting review app ${appName} (id: ${appId})`,
});

return '';
},
};
5 changes: 5 additions & 0 deletions build/routes/scalingo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ module.exports = [
path: '/build/scalingo/deploy-endpoint',
handler: scalingoController.deployEndpoint,
},
{
method: 'POST',
path: '/build/scalingo/restart-review-app',
handler: scalingoController.restartReviewApp,
},
];

0 comments on commit e6ec400

Please sign in to comment.