mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
⚡ Add debug log in healthcheck and enable DB logging via environment (#2744)
* ⚡ add debug log in healthcheck * ⚡ add DB logging * CR
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/* eslint-disable no-case-declarations */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { UserSettings } from 'n8n-core';
|
||||
import { ConnectionOptions, createConnection, getRepository } from 'typeorm';
|
||||
import { ConnectionOptions, createConnection, getRepository, LoggerOptions } from 'typeorm';
|
||||
import { TlsOptions } from 'tls';
|
||||
import * as path from 'path';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
@@ -104,10 +104,29 @@ export async function init(): Promise<IDatabaseCollections> {
|
||||
throw new Error(`The database "${dbType}" is currently not supported!`);
|
||||
}
|
||||
|
||||
let loggingOption: LoggerOptions = (await GenericHelpers.getConfigValue(
|
||||
'database.logging.enabled',
|
||||
)) as boolean;
|
||||
|
||||
if (loggingOption) {
|
||||
const optionsString = (
|
||||
(await GenericHelpers.getConfigValue('database.logging.options')) as string
|
||||
).replace(/\s+/g, '');
|
||||
|
||||
if (optionsString === 'all') {
|
||||
loggingOption = optionsString;
|
||||
} else {
|
||||
loggingOption = optionsString.split(',') as LoggerOptions;
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(connectionOptions, {
|
||||
entities: Object.values(entities),
|
||||
synchronize: false,
|
||||
logging: false,
|
||||
logging: loggingOption,
|
||||
maxQueryExecutionTime: (await GenericHelpers.getConfigValue(
|
||||
'database.logging.maxQueryExecutionTime',
|
||||
)) as string,
|
||||
});
|
||||
|
||||
let connection = await createConnection(connectionOptions);
|
||||
|
||||
Reference in New Issue
Block a user