Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
rodriguestiago0 committed Oct 3, 2024
1 parent cd8f253 commit 09cfd51
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
8 changes: 5 additions & 3 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const MAIN_ACCOUNT_ID = process.env.MAIN_ACCOUNT_ID || "";

const ENABLE_INTEREST_CALCULATION= process.env.ENABLE_INTEREST_CALCULATION || false;
const ENABLE_PAYEE_RENAME = process.env.ENABLE_PAYEE_RENAME || false;
const ENABLE_GHSOTFOLIO_SYNC = process.env.ENABLE_GHOSTFOLIO_SYNC || false;
const ENABLE_GHOSTFOLIO_SYNC = process.env.ENABLE_GHOSTFOLIO_SYNC || false;
const GHOSTFOLIO_SERVER_URL = process.env.GHOSTFOLIO_SERVER_URL || "";
const GHOSTFOLIO_TOKEN = process.env.GHOSTFOLIO_TOKEN || "";

Expand All @@ -25,6 +25,7 @@ const ACTUAL_SYNC_ID = process.env.ACTUAL_SYNC_ID || "";

const ENABLE_HOLD_INCOME_FOR_NEXT_MONTH = process.env.ENABLE_HOLD_INCOME_FOR_NEXT_MONTH || false;


function validateEnv(variables){
// Assert that all required environment variables are set
Object.entries(variables).forEach(([key, value]) => {
Expand Down Expand Up @@ -60,7 +61,7 @@ function getAppConfigFromEnv() {

GHOSTFOLIO_ACCOUNT_MAPPING = {}
GHOSTFOLIO_ACTUAL_PAYEE_NAME_MAPPING = {}
if (ENABLE_GHSOTFOLIO_SYNC) {
if (ENABLE_GHOSTFOLIO_SYNC) {

ghostfolioAccount = process.env.GHOSTFOLIO_ACCOUNT
actualAccount = process.env.GHOSTFOLIO_ACTUAL_ACCOUNT
Expand Down Expand Up @@ -112,11 +113,12 @@ function getAppConfigFromEnv() {
INTEREST_RATE,
ENABLE_INTEREST_CALCULATION,
ENABLE_PAYEE_RENAME,
ENABLE_GHSOTFOLIO_SYNC,
ENABLE_GHOSTFOLIO_SYNC,
GHOSTFOLIO_ACCOUNT_MAPPING,
GHOSTFOLIO_ACTUAL_PAYEE_NAME_MAPPING,
GHOSTFOLIO_SERVER_URL,
GHOSTFOLIO_TOKEN,
ENABLE_HOLD_INCOME_FOR_NEXT_MONTH
}

return appConfig
Expand Down
22 changes: 21 additions & 1 deletion index-cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,40 @@ console.info("Defined cron is: ", cronExpression)
const interval = parser.parseExpression(cronExpression);
console.info('Next run:', interval.next().toISOString());

if (appConfig.ENABLE_INTEREST_CALCULATION) {
console.info("Task interest calculation enabled")
}

if (appConfig.ENABLE_PAYEE_RENAME) {
console.info("Task fix payees enabled")
}

if (appConfig.ENABLE_GHOSTFOLIO_SYNC) {
console.info("Task ghostfolio sync enabled")
}

if (appConfig.ENABLE_HOLD_INCOME_FOR_NEXT_MONTH){
console.info("Task hold for next month enabled")
}

cron.schedule(cronExpression, async () => {
if (appConfig.ENABLE_INTEREST_CALCULATION) {
console.info("Running interest calculation")
await calculateMortage();
}

if (appConfig.ENABLE_PAYEE_RENAME) {
console.info("Running fix payees")
await fixPayees();
}

if (appConfig.ENABLE_GHSOTFOLIO_SYNC) {
if (appConfig.ENABLE_GHOSTFOLIO_SYNC) {
console.info("Running ghostfolio sync")
await ghostfolioSync();
}

if (appConfig.ENABLE_HOLD_INCOME_FOR_NEXT_MONTH){
console.info("Running hold for next month")
await holdAmoutForNextMonth();
}
console.info('Next run:', interval.next().toISOString());
Expand Down

0 comments on commit 09cfd51

Please sign in to comment.