Files
n8n-enterprise-unlocked/packages/cli/src/databases/utils/generators.ts
T
Michael AuerswaldandGitHub 6499f42481 feat(core): Add unique id to instances (#6863)
* add serverId and workerId

* adjust id format

* fix logger init / test

* update implementation
2023-08-07 17:03:21 +02:00

13 lines
366 B
TypeScript

import { customAlphabet } from 'nanoid';
import type { N8nInstanceType } from '@/Interfaces';
const nanoid = customAlphabet('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 16);
export function generateNanoId() {
return nanoid();
}
export function generateHostInstanceId(instanceType: N8nInstanceType) {
return `${instanceType}-${nanoid()}`;
}