Disable file.drop on master

This commit is contained in:
Raven Scott
2026-05-28 01:30:42 -04:00
parent dff3fb2040
commit 64b9b6f9b8
2 changed files with 10 additions and 1 deletions
+9 -1
View File
@@ -10,6 +10,7 @@ const fsSync = require('fs');
const path = require('path');
const { logDebug, logError, logInfo, logWarn } = require('../infrastructure/logger');
const { getPersistentPublicKey } = require('../infrastructure/utils');
const { resolveIsMaster } = require('../infrastructure/master-mode');
const sdk = require('./sdk');
// Store loaded plugins
@@ -38,7 +39,8 @@ function loadPluginConfig(pluginDir) {
dependencies: {},
www: 'www',
domain: path.basename(pluginDir), // Default domain is directory name
enabled: true // Default to enabled if not specified
enabled: true, // Default to enabled if not specified
disable_on_master: false // Disable plugin on master node when true
};
try {
@@ -107,6 +109,12 @@ async function loadPlugin(domain, pluginDir) {
logInfo('PluginHandler', `Plugin ${domain} is disabled in config.json, skipping initialization completely (no hyperdb, no channels, nothing)`);
return null;
}
// Optionally disable plugin when running as master
if (config.disable_on_master === true && resolveIsMaster() && !SYSTEM_PLUGINS.includes(pluginDomain)) {
logInfo('PluginHandler', `Plugin ${domain} is disabled on master (disable_on_master=true), skipping initialization`);
return null;
}
// Determine www directory path
const wwwDirName = config.www || 'www';