Skip to content

Commit

Permalink
fix: return whole file from yaml source
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves authored Jun 1, 2024
1 parent 94d8136 commit 7be2f04
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ function start() {
mkdirSync(join(logsFolder), { recursive: true });
const { jobs = [], services = [] } = loadJobs();

if (!jobs.length && !services.length) {
console.log('Nothing to run.');
}

for (const job of jobs) {
debug &&
console.log(`[${job.name}] registered with interval "${job.interval}"`);
Expand Down Expand Up @@ -172,8 +176,7 @@ function loadJobs() {
const src = readFileSync(jobsFile, "utf8");

if (jobsFile.endsWith(".yaml") || jobsFile.endsWith(".yml")) {
const json = loadYaml(src);
return json.jobs;
return loadYaml(src);
} else {
return JSON.parse(src);
}
Expand Down

0 comments on commit 7be2f04

Please sign in to comment.