mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 04:23:57 +00:00
fixed npm dist subprocess problem
This commit is contained in:
@@ -111,7 +111,7 @@ module.exports = {
|
||||
stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
|
||||
env: {
|
||||
...process.env,
|
||||
DBGATE_API: global['API_PACKAGE'] || global['dbgateApiModulePath'] || process.argv[1],
|
||||
DBGATE_API: global['API_PACKAGE'] || process.argv[1],
|
||||
..._.fromPairs(pluginNames.map(name => [`PLUGIN_${_.camelCase(name)}`, getPluginBackendPath(name)])),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ if (processArgs.startProcess) {
|
||||
const proc = require('./proc');
|
||||
const module = proc[processArgs.startProcess];
|
||||
module.start();
|
||||
} else if (!processArgs.checkParent && !global['API_PACKAGE'] && !global['dbgateApiModulePath']) {
|
||||
} else if (!processArgs.checkParent && !global['API_PACKAGE']) {
|
||||
const main = require('./main');
|
||||
|
||||
main.start();
|
||||
|
||||
@@ -54,7 +54,7 @@ function packagedPluginsDir() {
|
||||
}
|
||||
if (platformInfo.isNpmDist) {
|
||||
// node_modules
|
||||
return global['dbgateApiPackagedPluginsPath'];
|
||||
return global['PLUGINS_DIR'];
|
||||
}
|
||||
if (platformInfo.isElectronBundle) {
|
||||
return path.resolve(__dirname, '../../plugins');
|
||||
|
||||
@@ -10,7 +10,7 @@ const isMac = platform === 'darwin';
|
||||
const isLinux = platform === 'linux';
|
||||
const isDocker = fs.existsSync('/home/dbgate-docker/public');
|
||||
const isDevMode = process.env.DEVMODE == '1';
|
||||
const isNpmDist = !!global['dbgateApiModulePath'];
|
||||
const isNpmDist = !!global['IS_NPM_DIST'];
|
||||
const isForkedApi = processArgs.isForkedApi;
|
||||
|
||||
// function moduleAvailable(name) {
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
const path = require('path');
|
||||
require('dotenv').config();
|
||||
|
||||
global.dbgateApiModulePath = path.dirname(path.dirname(require.resolve('dbgate-api')));
|
||||
global.dbgateApiPackagedPluginsPath = path.dirname(global.dbgateApiModulePath);
|
||||
global.API_PACKAGE = path.dirname(path.dirname(require.resolve('dbgate-api')));
|
||||
global.PLUGINS_DIR = path.dirname(global.API_PACKAGE);
|
||||
global.IS_NPM_DIST = true;
|
||||
|
||||
const dbgateApi = require('dbgate-api');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user