diff --git a/packages/api/src/controllers/runners.js b/packages/api/src/controllers/runners.js index 0abb6466..98eab3b6 100644 --- a/packages/api/src/controllers/runners.js +++ b/packages/api/src/controllers/runners.js @@ -98,7 +98,7 @@ module.exports = { const subprocess = fork(scriptFile, ['--checkParent', ...process.argv.slice(3)], { stdio: ['ignore', 'pipe', 'pipe', 'ipc'], env: { - DBGATE_API: process.argv[1], + DBGATE_API: global['dbgateApiModulePath'] || process.argv[1], DBGATE_CWD: directory, ..._.fromPairs(pluginNames.map(name => [`PLUGIN_${_.camelCase(name)}`, path.join(pluginsdir(), name)])), }, diff --git a/packages/dbgate/bin/dbgate.js b/packages/dbgate/bin/dbgate.js index be7f1240..fbf9b73b 100755 --- a/packages/dbgate/bin/dbgate.js +++ b/packages/dbgate/bin/dbgate.js @@ -2,4 +2,6 @@ const dbgateApi = require('dbgate-api'); +global.dbgateApiModulePath = require.resolve('dbgate-api'); + dbgateApi.getMainModule().start('startNodeWeb');