refactor(core): Refactor nodes loading (no-changelog) (#7283)
fixes PAY-605
This commit is contained in:
committed by
GitHub
parent
789e1e7ed4
commit
c5ee06cc61
@@ -10,8 +10,6 @@ import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
import * as CrashJournal from '@/CrashJournal';
|
||||
import { LICENSE_FEATURES, inTest } from '@/constants';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { initErrorHandling } from '@/ErrorReporting';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
@@ -30,8 +28,6 @@ export abstract class BaseCommand extends Command {
|
||||
|
||||
protected externalHooks: IExternalHooksClass;
|
||||
|
||||
protected loadNodesAndCredentials: LoadNodesAndCredentials;
|
||||
|
||||
protected nodeTypes: NodeTypes;
|
||||
|
||||
protected userSettings: IUserSettings;
|
||||
@@ -54,12 +50,8 @@ export abstract class BaseCommand extends Command {
|
||||
// Make sure the settings exist
|
||||
this.userSettings = await UserSettings.prepareUserSettings();
|
||||
|
||||
this.loadNodesAndCredentials = Container.get(LoadNodesAndCredentials);
|
||||
await this.loadNodesAndCredentials.init();
|
||||
await Container.get(LoadNodesAndCredentials).init();
|
||||
this.nodeTypes = Container.get(NodeTypes);
|
||||
this.nodeTypes.init();
|
||||
const credentialTypes = Container.get(CredentialTypes);
|
||||
CredentialsOverwrites(credentialTypes);
|
||||
|
||||
await Db.init().catch(async (error: Error) =>
|
||||
this.exitWithCrash('There was an error initializing DB', error),
|
||||
|
||||
@@ -23,7 +23,6 @@ import * as Db from '@/Db';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { Server } from '@/Server';
|
||||
import { TestWebhooks } from '@/TestWebhooks';
|
||||
import { CommunityPackageService } from '@/services/communityPackage.service';
|
||||
import { EDITOR_UI_DIST_DIR, GENERATED_STATIC_DIR } from '@/constants';
|
||||
import { eventBus } from '@/eventbus';
|
||||
import { BaseCommand } from './BaseCommand';
|
||||
@@ -257,8 +256,6 @@ export class Start extends BaseCommand {
|
||||
config.set('userManagement.jwtSecret', createHash('sha256').update(baseKey).digest('hex'));
|
||||
}
|
||||
|
||||
await this.loadNodesAndCredentials.generateTypesForFrontend();
|
||||
|
||||
await UserSettings.getEncryptionKey();
|
||||
|
||||
// Load settings from database and set them to config.
|
||||
@@ -270,12 +267,11 @@ export class Start extends BaseCommand {
|
||||
const areCommunityPackagesEnabled = config.getEnv('nodes.communityPackages.enabled');
|
||||
|
||||
if (areCommunityPackagesEnabled) {
|
||||
await Container.get(CommunityPackageService).setMissingPackages(
|
||||
this.loadNodesAndCredentials,
|
||||
{
|
||||
reinstallMissingPackages: flags.reinstallMissingPackages,
|
||||
},
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const { CommunityPackagesService } = await import('@/services/communityPackages.service');
|
||||
await Container.get(CommunityPackagesService).setMissingPackages({
|
||||
reinstallMissingPackages: flags.reinstallMissingPackages,
|
||||
});
|
||||
}
|
||||
|
||||
const dbType = config.getEnv('database.type');
|
||||
|
||||
@@ -463,7 +463,7 @@ export class Worker extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CredentialsOverwrites().setData(body);
|
||||
Container.get(CredentialsOverwrites).setData(body);
|
||||
presetCredentialsLoaded = true;
|
||||
ResponseHelper.sendSuccessResponse(res, { success: true }, true, 200);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user