Skip to content

Commit 85d4a4e

Browse files
committed
allow manually triggered import if sync disabled
1 parent 77193d1 commit 85d4a4e

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

server/server.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ module.exports = function server(options = {}) {
4141
});
4242

4343
function checkConfiguration({ agent }, res, next) {
44-
if (!agent.isEnabled()) {
45-
console.error({ status: "ignored" });
46-
res.status(403).json({ status: "ignored" });
47-
} else if (!agent.isConfigured()) {
44+
if (!agent.isConfigured()) {
4845
console.error({ status: "not configured" });
4946
res.status(403).json({ status: "not configured" });
5047
} else {
@@ -81,8 +78,13 @@ module.exports = function server(options = {}) {
8178
});
8279

8380
app.post("/sync", checkConfiguration, ({ agent }, res) => {
84-
agent.async("startSync");
85-
res.json({ status: "scheduled" });
81+
const response = { status: "ignored" };
82+
if (agent.isEnabled()) {
83+
response.status = "scheduled";
84+
agent.async("startSync");
85+
}
86+
87+
res.json(response);
8688
});
8789

8890
// Error Handler

0 commit comments

Comments
 (0)