mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
refactor(core): Delete dead code in ExternalHooks (no-changelog) (#10100)
This commit is contained in:
parent
1b6c2d3a37
commit
7a135df768
|
@ -42,17 +42,7 @@ export class ExternalHooks {
|
||||||
this.initDidRun = true;
|
this.initDidRun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async reload(externalHooks?: IExternalHooksFileData) {
|
private async loadHooksFiles() {
|
||||||
this.externalHooks = {};
|
|
||||||
|
|
||||||
if (externalHooks === undefined) {
|
|
||||||
await this.loadHooksFiles(true);
|
|
||||||
} else {
|
|
||||||
this.loadHooks(externalHooks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadHooksFiles(reload = false) {
|
|
||||||
const externalHookFiles = config.getEnv('externalHookFiles').split(':');
|
const externalHookFiles = config.getEnv('externalHookFiles').split(':');
|
||||||
|
|
||||||
// Load all the provided hook-files
|
// Load all the provided hook-files
|
||||||
|
@ -60,10 +50,6 @@ export class ExternalHooks {
|
||||||
hookFilePath = hookFilePath.trim();
|
hookFilePath = hookFilePath.trim();
|
||||||
if (hookFilePath !== '') {
|
if (hookFilePath !== '') {
|
||||||
try {
|
try {
|
||||||
if (reload) {
|
|
||||||
delete require.cache[require.resolve(hookFilePath)];
|
|
||||||
}
|
|
||||||
|
|
||||||
const hookFile = require(hookFilePath) as IExternalHooksFileData;
|
const hookFile = require(hookFilePath) as IExternalHooksFileData;
|
||||||
this.loadHooks(hookFile);
|
this.loadHooks(hookFile);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -78,7 +64,7 @@ export class ExternalHooks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadHooks(hookFileData: IExternalHooksFileData) {
|
private loadHooks(hookFileData: IExternalHooksFileData) {
|
||||||
for (const resource of Object.keys(hookFileData)) {
|
for (const resource of Object.keys(hookFileData)) {
|
||||||
for (const operation of Object.keys(hookFileData[resource])) {
|
for (const operation of Object.keys(hookFileData[resource])) {
|
||||||
// Save all the hook functions directly under their string
|
// Save all the hook functions directly under their string
|
||||||
|
|
Loading…
Reference in a new issue