single connection config

This commit is contained in:
Jan Prochazka
2022-12-25 17:52:59 +01:00
parent a6fa116b5e
commit 54278f6276
3 changed files with 24 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ module.exports = {
return {
runAsPortal: !!connections.portalConnections,
singleDatabase: connections.singleDatabase,
singleConnection: connections.singleConnection,
// hideAppEditor: !!process.env.HIDE_APP_EDITOR,
allowShellConnection: platformInfo.allowShellConnection,
allowShellScripting: platformInfo.allowShellScripting,

View File

@@ -157,12 +157,31 @@ function getSingleDatabase() {
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 singleConnection = getSingleConnection();
module.exports = {
datastore: null,
opened: [],
singleDatabase,
singleConnection,
portalConnections,
async _init() {