dbconfig support in env variables

This commit is contained in:
Jan Prochazka 2022-03-17 20:19:53 +01:00
parent 728a2c6a9f
commit c135a068a2
2 changed files with 4 additions and 0 deletions

View File

@ -8,6 +8,8 @@ USER_mysql=root
PASSWORD_mysql=test
PORT_mysql=3307
ENGINE_mysql=mysql@dbgate-plugin-mysql
DBCONFIG_mysql=[{"name":"Chinook","connectionColor":"cyan"}]
SINGLE_CONNECTION=mysql
SINGLE_DATABASE=Chinook

View File

@ -11,6 +11,7 @@ const { pickSafeConnectionInfo } = require('../utility/crypting');
const JsonLinesDatabase = require('../utility/JsonLinesDatabase');
const processArgs = require('../utility/processArgs');
const { safeJsonParse } = require('dbgate-tools');
function getNamedArgs() {
const res = {};
@ -56,6 +57,7 @@ function getPortalCollections() {
singleDatabase: !!process.env[`DATABASE_${id}`] || !!process.env[`FILE_${id}`],
displayName: process.env[`LABEL_${id}`],
isReadOnly: process.env[`READONLY_${id}`],
databases: process.env[`DBCONFIG_${id}`] ? safeJsonParse(process.env[`DBCONFIG_${id}`]) : null,
// SSH tunnel
useSshTunnel: process.env[`USE_SSH_${id}`],