refactor(core): Move instanceType to InstanceSettings (no-changelog) (#10640)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-09-16 13:37:14 +02:00
committed by GitHub
parent 50beefb658
commit 25c8a328a8
25 changed files with 85 additions and 89 deletions

View File

@@ -16,6 +16,8 @@ type Settings = ReadOnlySettings & WritableSettings;
type InstanceRole = 'unset' | 'leader' | 'follower';
export type InstanceType = 'main' | 'webhook' | 'worker';
const inTest = process.env.NODE_ENV === 'test';
@Service()
@@ -40,6 +42,15 @@ export class InstanceSettings {
readonly instanceId = this.generateInstanceId();
readonly instanceType: InstanceType;
constructor() {
const command = process.argv[2];
this.instanceType = ['webhook', 'worker'].includes(command)
? (command as InstanceType)
: 'main';
}
/**
* A main is:
* - `unset` during bootup,

View File

@@ -10,7 +10,7 @@ export * from './Constants';
export * from './Credentials';
export * from './DirectoryLoader';
export * from './Interfaces';
export { InstanceSettings } from './InstanceSettings';
export { InstanceSettings, InstanceType } from './InstanceSettings';
export * from './NodeExecuteFunctions';
export * from './WorkflowExecute';
export { NodeExecuteFunctions };