fix: cached File

This commit is contained in:
2026-06-06 21:00:12 +02:00
parent 3ce4af8ef2
commit f844429dfb
2 changed files with 7 additions and 4 deletions

View File

@@ -2,6 +2,12 @@ import dotenv from "dotenv";
dotenv.config();
import axios from "axios";
import fs from "fs";
const CACHE_FILE = process.env.CACHE_FILE_Path;
if (!fs.existsSync(CACHE_FILE)) {
console.log("[INFO] CACHE_FILE Created!");
fs.writeFileSync(CACHE_FILE, "[]");
}
const BASE_URL = process.env.BASE_URL;
const divera_group_id = process.env.divera_status_groupid;
@@ -20,9 +26,6 @@ const WATCHED_VEHICLES = [
"10-04-1",
];
// Datei für letzten Zustand
const CACHE_FILE = "./vehicle-cache.json";
// Intervall in ms
const POLL_INTERVAL = 15000;
@@ -78,4 +81,5 @@ async function main() {
fs.writeFileSync(CACHE_FILE, JSON.stringify(newData));
}
console.log("[INFO] Start Intervall!");
setInterval(main, 1000 * process.env.intervall);