diff --git a/docker-compose.yml b/docker-compose.yml index 115db40..1e2facd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,3 +23,4 @@ services: - hub-data:/data # passkeys, calendar links and the session secret live here volumes: hub-data: + name: nehub-data # fixed name so the data survives redeploys and renamed stacks diff --git a/server.js b/server.js index 2969b0f..277a632 100644 --- a/server.js +++ b/server.js @@ -262,6 +262,12 @@ async function plexProxy(req, res) { } catch (e) { if (!res.headersSent) { res.writeHead(502); res.end(); } else res.destroy(); } } +{ // Make it obvious in the log whether data survived a redeploy. + const dir = process.env.DATA_DIR || require('path').join(__dirname, 'data'); + const count = f => { try { const j = JSON.parse(require('fs').readFileSync(require('path').join(dir, f), 'utf8')); return Array.isArray(j) ? j.length : (j.creds || []).length; } catch { return 0; } }; + console.log(`[data] ${dir}: ${count('passkeys.json')} passkeys, ${count('calendars.json')} calendars`); +} + if (!JWT_SECRET) console.warn('WARNING: ONLYOFFICE_JWT_SECRET not set. In-app editing only works if the Document Server has JWT disabled, and save callbacks are unauthenticated. Testing only.'); http.createServer((req, res) => {