Skip to content

Commit

Permalink
add ghostfolio cron
Browse files Browse the repository at this point in the history
  • Loading branch information
rodriguestiago0 committed Aug 4, 2024
1 parent 9752ab8 commit 04f83cd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index-cron.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { fixPayees, calculateMortage, init } = require("./engine.js");
const { fixPayees, calculateMortage, ghostfolioSync } = require("./engine.js");
var cron = require('node-cron');
const parser = require('cron-parser');
const { getAppConfigFromEnv } = require("./config");

const appConfig = getAppConfigFromEnv();

var cronExpression = "0 0 */4 * * *";
var cronExpression = "0 */4 * * *";
if (appConfig.CRON_EXPRESSION != "") {
cronExpression = appConfig.CRON_EXPRESSION
}
Expand All @@ -17,9 +17,14 @@ cron.schedule(cronExpression, async () => {
if (appConfig.ENABLE_INTEREST_CALCULATION) {
await calculateMortage();
}

if (appConfig.ENABLE_PAYEE_RENAME) {
await fixPayees();
}

if (appConfig.ENABLE_GHSOTFOLIO_SYNC) {
await ghostfolioSync();
}
console.info('Next run:', interval.next().toISOString());
});

0 comments on commit 04f83cd

Please sign in to comment.