chore: sync running docker state
Commit the app code currently running in Docker, including scheduler, store status, journal reminder, maintenance mode, and Foodsharing API check updates. Remove generated runtime logs from version control and ignore local runtime captures.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { readJsonFile, writeJsonFile } = require('./jsonFileStore');
|
||||
|
||||
const CONFIG_DIR = path.join(__dirname, '..', 'config');
|
||||
const IMAGE_ROOT = path.join(CONFIG_DIR, 'journal-images');
|
||||
@@ -27,7 +28,7 @@ function hydrateJournalFile(profileId) {
|
||||
ensureBaseDirs();
|
||||
const filePath = getJournalPath(profileId);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
fs.writeFileSync(filePath, JSON.stringify([], null, 2));
|
||||
writeJsonFile(filePath, [], { backup: false });
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
@@ -35,8 +36,7 @@ function hydrateJournalFile(profileId) {
|
||||
function readJournal(profileId) {
|
||||
const filePath = hydrateJournalFile(profileId);
|
||||
try {
|
||||
const raw = fs.readFileSync(filePath, 'utf8');
|
||||
const parsed = JSON.parse(raw);
|
||||
const parsed = readJsonFile(filePath, [], Array.isArray);
|
||||
return Array.isArray(parsed) ? parsed : [];
|
||||
} catch (error) {
|
||||
console.error(`[JOURNAL] Konnte Journal für ${profileId} nicht lesen:`, error.message);
|
||||
@@ -46,7 +46,7 @@ function readJournal(profileId) {
|
||||
|
||||
function writeJournal(profileId, entries = []) {
|
||||
const filePath = hydrateJournalFile(profileId);
|
||||
fs.writeFileSync(filePath, JSON.stringify(entries, null, 2));
|
||||
writeJsonFile(filePath, entries);
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user