dbgate-api 4.7.4-alpha.10 → 4.7.4-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dbgate-api",
3
3
  "main": "src/index.js",
4
- "version": "4.7.4-alpha.10",
4
+ "version": "4.7.4-alpha.15",
5
5
  "homepage": "https://dbgate.org/",
6
6
  "repository": {
7
7
  "type": "git",
@@ -25,9 +25,9 @@
25
25
  "compare-versions": "^3.6.0",
26
26
  "cors": "^2.8.5",
27
27
  "cross-env": "^6.0.3",
28
- "dbgate-query-splitter": "^4.7.4-alpha.10",
29
- "dbgate-sqltree": "^4.7.4-alpha.10",
30
- "dbgate-tools": "^4.7.4-alpha.10",
28
+ "dbgate-query-splitter": "^4.7.4-alpha.15",
29
+ "dbgate-sqltree": "^4.7.4-alpha.15",
30
+ "dbgate-tools": "^4.7.4-alpha.15",
31
31
  "diff": "^5.0.0",
32
32
  "diff2html": "^3.4.13",
33
33
  "eslint": "^6.8.0",
@@ -63,7 +63,7 @@
63
63
  "devDependencies": {
64
64
  "@types/fs-extra": "^9.0.11",
65
65
  "@types/lodash": "^4.14.149",
66
- "dbgate-types": "^4.7.4-alpha.10",
66
+ "dbgate-types": "^4.7.4-alpha.15",
67
67
  "env-cmd": "^10.1.0",
68
68
  "node-loader": "^1.0.2",
69
69
  "nodemon": "^2.0.2",
@@ -111,7 +111,7 @@ module.exports = {
111
111
  stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
112
112
  env: {
113
113
  ...process.env,
114
- DBGATE_API: global['API_PACKAGE'] || global['dbgateApiModulePath'] || process.argv[1],
114
+ DBGATE_API: global['API_PACKAGE'] || process.argv[1],
115
115
  ..._.fromPairs(pluginNames.map(name => [`PLUGIN_${_.camelCase(name)}`, getPluginBackendPath(name)])),
116
116
  },
117
117
  }
@@ -1,5 +1,5 @@
1
1
 
2
2
  module.exports = {
3
- version: '4.7.4-alpha.10',
4
- buildTime: '2022-03-21T19:56:58.513Z'
3
+ version: '4.7.4-alpha.15',
4
+ buildTime: '2022-03-24T13:03:43.099Z'
5
5
  };
package/src/index.js CHANGED
@@ -8,7 +8,7 @@ if (processArgs.startProcess) {
8
8
  const proc = require('./proc');
9
9
  const module = proc[processArgs.startProcess];
10
10
  module.start();
11
- } else if (!processArgs.checkParent && !global['API_PACKAGE'] && !global['dbgateApiModulePath']) {
11
+ } else if (!processArgs.checkParent && !global['API_PACKAGE']) {
12
12
  const main = require('./main');
13
13
 
14
14
  main.start();
package/src/main.js CHANGED
@@ -86,6 +86,10 @@ function start() {
86
86
  if (platformInfo.isDocker) {
87
87
  // server static files inside docker container
88
88
  app.use(getExpressPath('/'), express.static('/home/dbgate-docker/public'));
89
+
90
+ const port = process.env.PORT || 3000;
91
+ console.log('DbGate API listening on port (docker build)', port);
92
+ server.listen(port);
89
93
  } else if (platformInfo.isNpmDist) {
90
94
  app.use(getExpressPath('/'), express.static(path.join(__dirname, '../../dbgate-web/public')));
91
95
  getPort({
@@ -95,7 +99,7 @@ function start() {
95
99
  ),
96
100
  }).then(port => {
97
101
  server.listen(port, () => {
98
- console.log(`DbGate API listening on port ${port}`);
102
+ console.log(`DbGate API listening on port ${port} (NPM build)`);
99
103
  });
100
104
  });
101
105
  } else if (process.env.DEVWEB) {
@@ -104,7 +108,7 @@ function start() {
104
108
  app.use(getExpressPath('/'), express.static(path.join(__dirname, '../../web/public')));
105
109
 
106
110
  const port = process.env.PORT || 3000;
107
- console.log('DbGate API & web listening on port', port);
111
+ console.log('DbGate API & web listening on port (dev web build)', port);
108
112
  server.listen(port);
109
113
  } else {
110
114
  app.get(getExpressPath('/'), (req, res) => {
@@ -112,7 +116,7 @@ function start() {
112
116
  });
113
117
 
114
118
  const port = process.env.PORT || 3000;
115
- console.log('DbGate API listening on port', port);
119
+ console.log('DbGate API listening on port (dev API build)', port);
116
120
  server.listen(port);
117
121
  }
118
122
 
@@ -3,6 +3,7 @@ const path = require('path');
3
3
  const fs = require('fs');
4
4
  const cleanDirectory = require('./cleanDirectory');
5
5
  const platformInfo = require('./platformInfo');
6
+ const processArgs = require('./processArgs');
6
7
 
7
8
  const createDirectories = {};
8
9
  const ensureDirectory = (dir, clean) => {
@@ -54,7 +55,10 @@ function packagedPluginsDir() {
54
55
  }
55
56
  if (platformInfo.isNpmDist) {
56
57
  // node_modules
57
- return global['dbgateApiPackagedPluginsPath'];
58
+ return global['PLUGINS_DIR'];
59
+ }
60
+ if (processArgs.pluginsDir) {
61
+ return processArgs.pluginsDir;
58
62
  }
59
63
  if (platformInfo.isElectronBundle) {
60
64
  return path.resolve(__dirname, '../../plugins');
@@ -10,7 +10,7 @@ const isMac = platform === 'darwin';
10
10
  const isLinux = platform === 'linux';
11
11
  const isDocker = fs.existsSync('/home/dbgate-docker/public');
12
12
  const isDevMode = process.env.DEVMODE == '1';
13
- const isNpmDist = !!global['dbgateApiModulePath'];
13
+ const isNpmDist = !!global['IS_NPM_DIST'];
14
14
  const isForkedApi = processArgs.isForkedApi;
15
15
 
16
16
  // function moduleAvailable(name) {
@@ -9,10 +9,17 @@ function getNamedArg(name) {
9
9
  const checkParent = process.argv.includes('--checkParent');
10
10
  const startProcess = getNamedArg('--start-process');
11
11
  const isForkedApi = process.argv.includes('--is-forked-api');
12
+ const pluginsDir = getNamedArg('--plugins-dir');
12
13
 
13
14
  function getPassArgs() {
14
- if (global['NATIVE_MODULES']) return ['--native-modules', global['NATIVE_MODULES']];
15
- return [];
15
+ const res = [];
16
+ if (global['NATIVE_MODULES']) {
17
+ res.push('--native-modules', global['NATIVE_MODULES']);
18
+ }
19
+ if (global['PLUGINS_DIR']) {
20
+ res.push('--plugins-dir', global['PLUGINS_DIR']);
21
+ }
22
+ return res;
16
23
  }
17
24
 
18
25
  module.exports = {
@@ -20,4 +27,5 @@ module.exports = {
20
27
  startProcess,
21
28
  isForkedApi,
22
29
  getPassArgs,
30
+ pluginsDir,
23
31
  };