forked from snxraven/p2ns
Disable file.drop on master
This commit is contained in:
@@ -10,6 +10,7 @@ const fsSync = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { logDebug, logError, logInfo, logWarn } = require('../infrastructure/logger');
|
const { logDebug, logError, logInfo, logWarn } = require('../infrastructure/logger');
|
||||||
const { getPersistentPublicKey } = require('../infrastructure/utils');
|
const { getPersistentPublicKey } = require('../infrastructure/utils');
|
||||||
|
const { resolveIsMaster } = require('../infrastructure/master-mode');
|
||||||
const sdk = require('./sdk');
|
const sdk = require('./sdk');
|
||||||
|
|
||||||
// Store loaded plugins
|
// Store loaded plugins
|
||||||
@@ -38,7 +39,8 @@ function loadPluginConfig(pluginDir) {
|
|||||||
dependencies: {},
|
dependencies: {},
|
||||||
www: 'www',
|
www: 'www',
|
||||||
domain: path.basename(pluginDir), // Default domain is directory name
|
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 {
|
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)`);
|
logInfo('PluginHandler', `Plugin ${domain} is disabled in config.json, skipping initialization completely (no hyperdb, no channels, nothing)`);
|
||||||
return null;
|
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
|
// Determine www directory path
|
||||||
const wwwDirName = config.www || 'www';
|
const wwwDirName = config.www || 'www';
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"domain": "file.drop",
|
"domain": "file.drop",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"disable_on_master": true,
|
||||||
"description": "Temporary 24-hour file storage with shareable links",
|
"description": "Temporary 24-hour file storage with shareable links",
|
||||||
"author": "P2NS",
|
"author": "P2NS",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
Reference in New Issue
Block a user