warn if node is not launched with 'NODE_ENV=production'

This commit is contained in:
ansuz 2022-03-22 15:40:43 +05:30
parent f34a60665f
commit af10547dca
2 changed files with 5 additions and 0 deletions

View File

@ -72,6 +72,8 @@ module.exports.create = function (config) {
NO_SANDBOX: NO_SANDBOX,
httpSafePort: httpSafePort,
NODE_ENV: process.env.NODE_ENV,
shouldUpdateNode: !isRecentVersion(),
version: Package.version,

View File

@ -332,6 +332,9 @@ nThen(function (w) {
currentVersion: process.version,
});
}
if (Env.NODE_ENV !== 'production') {
Env.Log.warn("NODE_ENV", `If this server is running in a production context then it is recommended that you set NODE_ENV=production to prevent Expressjs from responding with stack traces when it catches an error.`);
}
if (Env.OFFLINE_MODE) { return; }
if (Env.websocketPath) { return; }