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,6 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const defaultConfig = require('../data/defaultConfig');
|
||||
const { readJsonFile, writeJsonFile } = require('./jsonFileStore');
|
||||
|
||||
const CONFIG_DIR = path.join(__dirname, '..', 'config');
|
||||
|
||||
@@ -18,7 +19,7 @@ function hydrateConfigFile(profileId) {
|
||||
ensureDir();
|
||||
const filePath = getConfigPath(profileId);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
fs.writeFileSync(filePath, JSON.stringify(defaultConfig, null, 2));
|
||||
writeJsonFile(filePath, defaultConfig, { backup: false });
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
@@ -26,8 +27,7 @@ function hydrateConfigFile(profileId) {
|
||||
function readConfig(profileId) {
|
||||
const filePath = hydrateConfigFile(profileId);
|
||||
try {
|
||||
const raw = fs.readFileSync(filePath, 'utf8');
|
||||
const parsed = JSON.parse(raw);
|
||||
const parsed = readJsonFile(filePath, defaultConfig, Array.isArray);
|
||||
return Array.isArray(parsed) ? parsed : [];
|
||||
} catch (err) {
|
||||
console.error(`Failed to read config for ${profileId}:`, err);
|
||||
@@ -37,7 +37,7 @@ function readConfig(profileId) {
|
||||
|
||||
function writeConfig(profileId, payload) {
|
||||
const filePath = hydrateConfigFile(profileId);
|
||||
fs.writeFileSync(filePath, JSON.stringify(payload, null, 2));
|
||||
writeJsonFile(filePath, payload);
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user