mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 23:03:58 +00:00
SYNC: #1077 set custom connection prop from ENV vars
This commit is contained in:
committed by
Diflow
parent
78d9b48854
commit
f3ce6ad467
@@ -102,12 +102,21 @@ function getPortalCollections() {
|
|||||||
trustServerCertificate: process.env[`SSL_TRUST_CERTIFICATE_${id}`],
|
trustServerCertificate: process.env[`SSL_TRUST_CERTIFICATE_${id}`],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
for(const conn of connections) {
|
||||||
|
for(const prop in process.env) {
|
||||||
|
if (prop.startsWith(`CONNECTION_${conn._id}_`)) {
|
||||||
|
const name = prop.substring(`CONNECTION_${conn._id}_`.length);
|
||||||
|
conn[name] = process.env[prop];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logger.info({ connections: connections.map(pickSafeConnectionInfo) }, 'Using connections from ENV variables');
|
logger.info({ connections: connections.map(pickSafeConnectionInfo) }, 'Using connections from ENV variables');
|
||||||
const noengine = connections.filter(x => !x.engine);
|
const noengine = connections.filter(x => !x.engine);
|
||||||
if (noengine.length > 0) {
|
if (noengine.length > 0) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
{ connections: noengine.map(x => x._id) },
|
{ connections: noengine.map(x => x._id) },
|
||||||
'Invalid CONNECTIONS configutation, missing ENGINE for connection ID'
|
'Invalid CONNECTIONS configuration, missing ENGINE for connection ID'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return connections;
|
return connections;
|
||||||
|
|||||||
Reference in New Issue
Block a user