mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 20:13:57 +00:00
single connection config
This commit is contained in:
7
packages/api/env/dblogin/.env
vendored
7
packages/api/env/dblogin/.env
vendored
@@ -1,12 +1,13 @@
|
|||||||
DEVMODE=1
|
DEVMODE=1
|
||||||
|
|
||||||
CONNECTIONS=mysql
|
CONNECTIONS=mysql
|
||||||
|
SINGLE_CONNECTION=mysql
|
||||||
|
|
||||||
LABEL_mysql=MySql localhost
|
LABEL_mysql=MySql localhost
|
||||||
SERVER_mysql=localhost
|
SERVER_mysql=localhost
|
||||||
# USER_mysql=root
|
USER_mysql=root
|
||||||
PORT_mysql=3306
|
PORT_mysql=3306
|
||||||
# PASSWORD_mysql=Pwd2020Db
|
PASSWORD_mysql=Pwd2020Db
|
||||||
ENGINE_mysql=mysql@dbgate-plugin-mysql
|
ENGINE_mysql=mysql@dbgate-plugin-mysql
|
||||||
# PASSWORD_MODE_mysql=askPassword
|
# PASSWORD_MODE_mysql=askPassword
|
||||||
PASSWORD_MODE_mysql=askUser
|
# PASSWORD_MODE_mysql=askUser
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ module.exports = {
|
|||||||
return {
|
return {
|
||||||
runAsPortal: !!connections.portalConnections,
|
runAsPortal: !!connections.portalConnections,
|
||||||
singleDatabase: connections.singleDatabase,
|
singleDatabase: connections.singleDatabase,
|
||||||
|
singleConnection: connections.singleConnection,
|
||||||
// hideAppEditor: !!process.env.HIDE_APP_EDITOR,
|
// hideAppEditor: !!process.env.HIDE_APP_EDITOR,
|
||||||
allowShellConnection: platformInfo.allowShellConnection,
|
allowShellConnection: platformInfo.allowShellConnection,
|
||||||
allowShellScripting: platformInfo.allowShellScripting,
|
allowShellScripting: platformInfo.allowShellScripting,
|
||||||
|
|||||||
@@ -157,12 +157,31 @@ function getSingleDatabase() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSingleConnection() {
|
||||||
|
if (getSingleDatabase()) return null;
|
||||||
|
if (process.env.SINGLE_CONNECTION) {
|
||||||
|
// @ts-ignore
|
||||||
|
const connection = portalConnections.find(x => x._id == process.env.SINGLE_CONNECTION);
|
||||||
|
if (connection) {
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// @ts-ignore
|
||||||
|
const arg0 = (portalConnections || []).find(x => x._id == 'argv');
|
||||||
|
if (arg0) {
|
||||||
|
return arg0;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const singleDatabase = getSingleDatabase();
|
const singleDatabase = getSingleDatabase();
|
||||||
|
const singleConnection = getSingleConnection();
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
datastore: null,
|
datastore: null,
|
||||||
opened: [],
|
opened: [],
|
||||||
singleDatabase,
|
singleDatabase,
|
||||||
|
singleConnection,
|
||||||
portalConnections,
|
portalConnections,
|
||||||
|
|
||||||
async _init() {
|
async _init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user