2024-09-12 09:07:18 -07:00
|
|
|
import { mkdirSync, mkdtempSync, writeFileSync } from 'fs';
|
2023-10-23 04:39:35 -07:00
|
|
|
import { tmpdir } from 'os';
|
|
|
|
import { join } from 'path';
|
|
|
|
|
2024-01-17 05:01:56 -08:00
|
|
|
process.env.N8N_ENCRYPTION_KEY = 'test_key';
|
|
|
|
|
2023-10-23 04:39:35 -07:00
|
|
|
const baseDir = join(tmpdir(), 'n8n-tests/');
|
|
|
|
mkdirSync(baseDir, { recursive: true });
|
|
|
|
|
|
|
|
const testDir = mkdtempSync(baseDir);
|
|
|
|
mkdirSync(join(testDir, '.n8n'));
|
|
|
|
process.env.N8N_USER_FOLDER = testDir;
|
|
|
|
|
|
|
|
writeFileSync(
|
|
|
|
join(testDir, '.n8n/config'),
|
2024-01-16 09:25:53 -08:00
|
|
|
JSON.stringify({ encryptionKey: 'test_key', instanceId: '123' }),
|
2024-10-23 02:54:53 -07:00
|
|
|
{
|
|
|
|
encoding: 'utf-8',
|
|
|
|
mode: 0o600,
|
|
|
|
},
|
2023-10-23 04:39:35 -07:00
|
|
|
);
|