Files
wekan/server/main.js
T
Lauri Ojansivu 71cd2aed05 Read MONGO_URL_FILE, MAIL_URL_FILE and S3_SECRET_KEY_FILE instead of three dead secret files.
MAIL_SERVICE_PASSWORD_FILE, MONGO_PASSWORD_FILE and S3_SECRET_FILE were
listed on every platform, and nothing read them. Per the maintainer decision
of 2026-10-08:

- MONGO_URL_FILE holds the whole MongoDB URL. Meteor connects before any
  WeKan code runs, so the Docker entrypoint, the snap's wekan-control,
  start-wekan.sh and start-wekan.bat read it and start WeKan with MONGO_URL
  set. An unreadable or empty file stops the start instead of falling back
  to a default database. The snap log now masks a password in MONGO_URL.
- MAIL_URL_FILE and S3_SECRET_KEY_FILE fill MAIL_URL and S3_SECRET_KEY first
  thing in server/main.js (models/lib/envSecretFiles.js). As for the login
  secrets, the variable wins over its file.
- The three dead names are gone from the Dockerfile, every docker-compose
  file, the snap settings and help, the start scripts and the docs. The
  example secret files are renamed to match, and WeKan logs a warning naming
  the replacement when a retired name is still set.

The issue itself was closed earlier, with only part of this done.

Thanks to xet7 !
2026-10-08 11:07:58 +03:00

30 lines
1.3 KiB
JavaScript

// ============================================================================
// WeKan Server Entry Point
//
// Uses require() to guarantee bootstrap runs before any model code.
// ============================================================================
// 0. Secrets from files (#5724): MAIL_URL_FILE and S3_SECRET_KEY_FILE fill
// MAIL_URL and S3_SECRET_KEY before any code reads them. Never the values
// in the log - only where each came from.
{
const { applySecretFiles, retiredSecretFiles } = require('/models/lib/envSecretFiles');
const report = applySecretFiles(process.env);
for (const [name, source] of Object.entries(report)) {
if (source === 'file') console.log(`[secrets] ${name} read from ${name}_FILE`);
else if (source.startsWith('file-error:')) console.error(`[secrets] ${name}_FILE cannot be used (${source.slice(11)}); ${name} is unset`);
}
for (const { name, replacement } of retiredSecretFiles(process.env)) {
console.warn(`[secrets] ${name} is not read by WeKan; use ${replacement} instead`);
}
}
// 1. Helpers polyfill (server no-op for .helpers())
require('/imports/collectionHelpers');
// 2. Collection2 (server-only)
require('meteor/aldeed:collection2');
// 3. Load all application code
require('/server/imports');