This commit is contained in:
parent
cf719e90ac
commit
68b996535d
1 changed files with 10 additions and 2 deletions
12
broker.ts
12
broker.ts
|
@ -37,6 +37,8 @@ exec('iching divine', (error, stdout, stderr) => {
|
|||
|
||||
if (config == undefined) {
|
||||
config = loadConfig();
|
||||
} else { //TODO: JUST FOR DEBUGGING
|
||||
console.log(`Config already read...`);
|
||||
}
|
||||
|
||||
console.log(config.daysInterval, config.timeOfDay);
|
||||
|
@ -53,11 +55,13 @@ exec('iching divine', (error, stdout, stderr) => {
|
|||
|
||||
// Funktion, um die Konfiguration zu laden
|
||||
function loadConfig(): Config {
|
||||
|
||||
console.log(`Load Config`);
|
||||
|
||||
const data = fs.readFileSync('config.json', 'utf-8');
|
||||
return JSON.parse(data);
|
||||
}
|
||||
|
||||
|
||||
// Send E-Mail
|
||||
async function sendEmail(content: string) {
|
||||
try {
|
||||
|
@ -89,7 +93,7 @@ async function sleep() {
|
|||
function calculateNextRunDate(daysInterval: number, timeOfDay: string): Date {
|
||||
const currentDate = new Date();
|
||||
|
||||
// Splitte die Uhrzeit in Stunden und Minuten
|
||||
/*// Splitte die Uhrzeit in Stunden und Minuten
|
||||
const [hours, minutes] = timeOfDay.split(':').map(Number);
|
||||
|
||||
// Berechne das Datum für die nächste Ausführung
|
||||
|
@ -103,6 +107,10 @@ function calculateNextRunDate(daysInterval: number, timeOfDay: string): Date {
|
|||
// Berechne das Datum für den nächsten Ausführungszeitpunkt unter Berücksichtigung von X Tagen
|
||||
currentDate.setDate(currentDate.getDate() + daysInterval);
|
||||
|
||||
return currentDate;*/
|
||||
|
||||
currentDate.setMinutes(currentDate.getMinutes() + 1); //TODO: JUST FOR DEBUGGING!!!
|
||||
|
||||
return currentDate;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue