Disable file.drop on master
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user