mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 01:03:58 +00:00
fix
This commit is contained in:
@@ -5,7 +5,7 @@ const uuidv1 = require('uuid/v1');
|
|||||||
const byline = require('byline');
|
const byline = require('byline');
|
||||||
const socket = require('../utility/socket');
|
const socket = require('../utility/socket');
|
||||||
const { fork } = require('child_process');
|
const { fork } = require('child_process');
|
||||||
const { rundir, uploadsdir, pluginsdir } = require('../utility/directories');
|
const { rundir, uploadsdir, pluginsdir, getPluginPath, packagedPluginList } = require('../utility/directories');
|
||||||
const { extractShellApiPlugins, extractShellApiFunctionName } = require('dbgate-tools');
|
const { extractShellApiPlugins, extractShellApiFunctionName } = require('dbgate-tools');
|
||||||
const { handleProcessCommunication } = require('../utility/processComm');
|
const { handleProcessCommunication } = require('../utility/processComm');
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ module.exports = {
|
|||||||
const scriptFile = path.join(uploadsdir(), runid + '.js');
|
const scriptFile = path.join(uploadsdir(), runid + '.js');
|
||||||
fs.writeFileSync(`${scriptFile}`, scriptText);
|
fs.writeFileSync(`${scriptFile}`, scriptText);
|
||||||
fs.mkdirSync(directory);
|
fs.mkdirSync(directory);
|
||||||
const pluginNames = fs.readdirSync(pluginsdir());
|
const pluginNames = _.union(fs.readdirSync(pluginsdir()), packagedPluginList);
|
||||||
console.log(`RUNNING SCRIPT ${scriptFile}`);
|
console.log(`RUNNING SCRIPT ${scriptFile}`);
|
||||||
// const subprocess = fork(scriptFile, ['--checkParent', '--max-old-space-size=8192'], {
|
// const subprocess = fork(scriptFile, ['--checkParent', '--max-old-space-size=8192'], {
|
||||||
const subprocess = fork(scriptFile, ['--checkParent', ...process.argv.slice(3)], {
|
const subprocess = fork(scriptFile, ['--checkParent', ...process.argv.slice(3)], {
|
||||||
@@ -101,7 +101,7 @@ module.exports = {
|
|||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
DBGATE_API: global['dbgateApiModulePath'] || process.argv[1],
|
DBGATE_API: global['dbgateApiModulePath'] || process.argv[1],
|
||||||
..._.fromPairs(pluginNames.map(name => [`PLUGIN_${_.camelCase(name)}`, path.join(pluginsdir(), name)])),
|
..._.fromPairs(pluginNames.map(name => [`PLUGIN_${_.camelCase(name)}`, getPluginPath(name)])),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const pipeDispatcher = severity => data =>
|
const pipeDispatcher = severity => data =>
|
||||||
|
|||||||
@@ -57,6 +57,14 @@ function packagedPluginsDir() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const packagedPluginList =
|
||||||
|
packagedPluginsDir() != null ? fs.readdirSync(packagedPluginsDir()).filter(x => x.startsWith('dbgate-plugin-')) : [];
|
||||||
|
|
||||||
|
function getPluginPath(packageName) {
|
||||||
|
if (packagedPluginList.includes(packageName)) return path.join(packagedPluginsDir(), packageName);
|
||||||
|
return path.join(pluginsdir(), packageName);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
datadir,
|
datadir,
|
||||||
jsldir,
|
jsldir,
|
||||||
@@ -67,4 +75,6 @@ module.exports = {
|
|||||||
pluginsdir,
|
pluginsdir,
|
||||||
filesdir,
|
filesdir,
|
||||||
packagedPluginsDir,
|
packagedPluginsDir,
|
||||||
|
packagedPluginList,
|
||||||
|
getPluginPath,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user