Skip to content

Commit

Permalink
Merge pull request #54 from Giveth/read-config-from-env
Browse files Browse the repository at this point in the history
Read cron config from env
  • Loading branch information
aminlatifi authored May 21, 2024
2 parents 1b1b89c + 7ca39db commit 530d4a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ export const PROJECT_VERIFY_SCHEMA = assertNotNull(
).toLocaleLowerCase();

export const START_BLOCK = parseInt(process.env.START_BLOCK || "5815457");

export const IMPORT_PROJECT_CRON_SCHEDULE =
process.env.IMPORT_PROJECT_CRON_SCHEDULE || "0 0 * * *"; // UTC
1 change: 0 additions & 1 deletion src/features/import-projects/config.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/features/import-projects/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cron from "node-cron";
import { fetchAndProcessGivethProjects } from "./giveth/helpers";
import { CRON_SCHEDULE } from "./config";
import { IMPORT_PROJECT_CRON_SCHEDULE } from "../../constants";

export const task = async () => {
console.log("Importing Projects", new Date());
Expand All @@ -10,7 +10,7 @@ export const task = async () => {
export const importProjects = async () => {
try {
console.log("Importing Projects has been scheduled.");
cron.schedule(CRON_SCHEDULE, task, {
cron.schedule(IMPORT_PROJECT_CRON_SCHEDULE, task, {
scheduled: true,
timezone: "UTC",
});
Expand Down

0 comments on commit 530d4a9

Please sign in to comment.