fix: Enable crash journal only in production mode (no-changelog) (#4948)

* consolidate various `NODE_ENV` checks in the `cli` package

* enable crash journal only in production
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-12-16 15:27:49 +01:00
committed by GitHub
parent 2a7cb0192a
commit 323bd78067
7 changed files with 20 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ import { mkdir, utimes, open, rm } from 'fs/promises';
import { join, dirname } from 'path';
import { UserSettings } from 'n8n-core';
import { LoggerProxy, sleep } from 'n8n-workflow';
import { inProduction } from '@/constants';
export const touchFile = async (filePath: string): Promise<void> => {
await mkdir(dirname(filePath), { recursive: true });
@@ -18,6 +19,8 @@ export const touchFile = async (filePath: string): Promise<void> => {
const journalFile = join(UserSettings.getUserN8nFolderPath(), 'crash.journal');
export const init = async () => {
if (!inProduction) return;
if (existsSync(journalFile)) {
// Crash detected
LoggerProxy.error('Last session crashed');