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 STORE_STATUS_FILE = path.join(__dirname, '..', 'config', 'store-watch-status.json');
|
||||
|
||||
@@ -13,12 +14,15 @@ function ensureDir() {
|
||||
function readStoreStatus() {
|
||||
ensureDir();
|
||||
if (!fs.existsSync(STORE_STATUS_FILE)) {
|
||||
fs.writeFileSync(STORE_STATUS_FILE, JSON.stringify({}, null, 2));
|
||||
writeJsonFile(STORE_STATUS_FILE, {}, { backup: false });
|
||||
return {};
|
||||
}
|
||||
try {
|
||||
const raw = fs.readFileSync(STORE_STATUS_FILE, 'utf8');
|
||||
const parsed = JSON.parse(raw);
|
||||
const parsed = readJsonFile(
|
||||
STORE_STATUS_FILE,
|
||||
{},
|
||||
(value) => value && typeof value === 'object' && !Array.isArray(value)
|
||||
);
|
||||
if (parsed && typeof parsed === 'object') {
|
||||
return parsed;
|
||||
}
|
||||
@@ -31,7 +35,7 @@ function readStoreStatus() {
|
||||
|
||||
function writeStoreStatus(cache = {}) {
|
||||
ensureDir();
|
||||
fs.writeFileSync(STORE_STATUS_FILE, JSON.stringify(cache, null, 2));
|
||||
writeJsonFile(STORE_STATUS_FILE, cache);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user