How to use the n8n-core.UserSettings.getUserN8nFolderPath function in n8n-core

To help you get started, we’ve selected a few n8n-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github n8n-io / n8n / packages / cli / src / Db.ts View on Github external
export async function init(synchronize?: boolean): Promise {
	const dbType = await GenericHelpers.getConfigValue('database.type') as DatabaseType;
	const n8nFolder = UserSettings.getUserN8nFolderPath();

	let entities;
	let connectionOptions: ConnectionOptions;

	let dbNotExistError: string | undefined;
	if (dbType === 'mongodb') {
		entities = MongoDb;
		connectionOptions = {
			type: 'mongodb',
			url: await GenericHelpers.getConfigValue('database.mongodb.connectionUrl') as string,
			useNewUrlParser: true,
		};
	} else if (dbType === 'postgresdb') {
		dbNotExistError = 'does not exist';
		entities = PostgresDb;
		connectionOptions = {