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 PREF_DIR = path.join(__dirname, '..', 'config');
|
||||
|
||||
@@ -40,12 +41,15 @@ function readPreferences(profileId) {
|
||||
ensureDir();
|
||||
const filePath = getPreferencesPath(profileId);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
fs.writeFileSync(filePath, JSON.stringify(DEFAULT_PREFERENCES, null, 2));
|
||||
writeJsonFile(filePath, DEFAULT_PREFERENCES, { backup: false });
|
||||
return { ...DEFAULT_PREFERENCES };
|
||||
}
|
||||
try {
|
||||
const raw = fs.readFileSync(filePath, 'utf8');
|
||||
const parsed = JSON.parse(raw);
|
||||
const parsed = readJsonFile(
|
||||
filePath,
|
||||
DEFAULT_PREFERENCES,
|
||||
(value) => value && typeof value === 'object' && !Array.isArray(value)
|
||||
);
|
||||
return {
|
||||
location: sanitizeLocation(parsed.location) || null
|
||||
};
|
||||
@@ -65,7 +69,7 @@ function writePreferences(profileId, patch = {}) {
|
||||
};
|
||||
ensureDir();
|
||||
const filePath = getPreferencesPath(profileId);
|
||||
fs.writeFileSync(filePath, JSON.stringify(next, null, 2));
|
||||
writeJsonFile(filePath, next);
|
||||
return next;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user