Skip to content

Commit

Permalink
Only send refresh on config change
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedal987 committed Jun 15, 2024
1 parent 27eee0f commit a8fa13c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ebs/src/modules/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,16 @@ app.post("/webhook/refresh", asyncCatch(async (req, res) => {
return;
}

await refreshConfig();
console.log("Refreshed config, new config version is ", activeConfig!.version);
await broadcastConfigRefresh(activeConfig!);
res.sendStatus(200);
// only refresh if the config.json file was changed
if(req.body.commits.some((commit: any) => commit.modified.includes("config.json"))) {
await refreshConfig();
console.log("Refreshed config, new config version is ", activeConfig!.version);
await broadcastConfigRefresh(activeConfig!);

res.sendStatus(200).send("Config refreshed.");
} else {
res.sendStatus(200).send("Config not refreshed.");
}
}));

app.get("/public/config", asyncCatch(async (req, res) => {
Expand Down

0 comments on commit a8fa13c

Please sign in to comment.