mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
engine resolve refactor
This commit is contained in:
parent
43b9304c7e
commit
0e860e8ba3
4
api/src/engines/index.js
Normal file
4
api/src/engines/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = connection => {
|
||||
const { engine } = connection;
|
||||
return require(`./${engine}`);
|
||||
};
|
@ -1,6 +1,8 @@
|
||||
const engines = require('../engines');
|
||||
|
||||
process.on('message', async connection => {
|
||||
try {
|
||||
const driver = require(`../engines/${connection.engine}/index`);
|
||||
const driver = engines(connection);
|
||||
const conn = await driver.connect(connection);
|
||||
const res = await driver.getVersion(conn);
|
||||
process.send(res);
|
||||
|
@ -1,8 +1,10 @@
|
||||
const engines = require('../engines');
|
||||
|
||||
let systemConnection;
|
||||
let storedConnection;
|
||||
|
||||
async function handleRefreshDatabases() {
|
||||
const driver = require(`../engines/${storedConnection.engine}/index`);
|
||||
const driver = engines(storedConnection);
|
||||
const databases = await driver.listDatabases(systemConnection);
|
||||
process.send({ msgtype: 'databases', databases });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user