mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 02:43:59 +00:00
show storage connection error
This commit is contained in:
@@ -17,6 +17,7 @@ const { checkLicense, checkLicenseKey } = require('../utility/checkLicense');
|
|||||||
const storage = require('./storage');
|
const storage = require('./storage');
|
||||||
const { getAuthProxyUrl } = require('../utility/authProxy');
|
const { getAuthProxyUrl } = require('../utility/authProxy');
|
||||||
const { getPublicHardwareFingerprint } = require('../utility/hardwareFingerprint');
|
const { getPublicHardwareFingerprint } = require('../utility/hardwareFingerprint');
|
||||||
|
const { extractErrorMessage } = require('dbgate-tools');
|
||||||
|
|
||||||
const lock = new AsyncLock();
|
const lock = new AsyncLock();
|
||||||
|
|
||||||
@@ -39,10 +40,12 @@ module.exports = {
|
|||||||
const isUserLoggedIn = authProvider.isUserLoggedIn(req);
|
const isUserLoggedIn = authProvider.isUserLoggedIn(req);
|
||||||
|
|
||||||
const singleConid = authProvider.getSingleConnectionId(req);
|
const singleConid = authProvider.getSingleConnectionId(req);
|
||||||
|
const storageConnectionError = storage.getStorageConnectionError();
|
||||||
|
|
||||||
const singleConnection = singleConid
|
const singleConnection =
|
||||||
? await connections.getCore({ conid: singleConid })
|
singleConid && !storageConnectionError
|
||||||
: connections.singleConnection;
|
? await connections.getCore({ conid: singleConid })
|
||||||
|
: connections.singleConnection;
|
||||||
|
|
||||||
let configurationError = null;
|
let configurationError = null;
|
||||||
if (process.env.STORAGE_DATABASE && process.env.BASIC_AUTH) {
|
if (process.env.STORAGE_DATABASE && process.env.BASIC_AUTH) {
|
||||||
@@ -50,8 +53,13 @@ module.exports = {
|
|||||||
'Basic authentization is not allowed, when using storage. Cannot use both STORAGE_DATABASE and BASIC_AUTH';
|
'Basic authentization is not allowed, when using storage. Cannot use both STORAGE_DATABASE and BASIC_AUTH';
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkedLicense = await checkLicense();
|
if (storageConnectionError && !configurationError) {
|
||||||
|
configurationError = extractErrorMessage(storageConnectionError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkedLicense = storageConnectionError ? null : await checkLicense();
|
||||||
const isLicenseValid = checkedLicense?.status == 'ok';
|
const isLicenseValid = checkedLicense?.status == 'ok';
|
||||||
|
const logoutUrl = storageConnectionError ? null : await authProvider.getLogoutUrl();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
runAsPortal: !!connections.portalConnections,
|
runAsPortal: !!connections.portalConnections,
|
||||||
@@ -68,7 +76,7 @@ module.exports = {
|
|||||||
trialDaysLeft: checkedLicense?.isGeneratedTrial && !checkedLicense?.isExpired ? checkedLicense?.daysLeft : null,
|
trialDaysLeft: checkedLicense?.isGeneratedTrial && !checkedLicense?.isExpired ? checkedLicense?.daysLeft : null,
|
||||||
checkedLicense,
|
checkedLicense,
|
||||||
configurationError,
|
configurationError,
|
||||||
logoutUrl: await authProvider.getLogoutUrl(),
|
logoutUrl,
|
||||||
permissions,
|
permissions,
|
||||||
login,
|
login,
|
||||||
// ...additionalConfigProps,
|
// ...additionalConfigProps,
|
||||||
|
|||||||
@@ -17,4 +17,8 @@ module.exports = {
|
|||||||
async getConnectionsForLoginPage() {
|
async getConnectionsForLoginPage() {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getStorageConnectionError() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -125,6 +125,13 @@
|
|||||||
}
|
}
|
||||||
internalRedirectTo(`/not-logged.html`);
|
internalRedirectTo(`/not-logged.html`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if ($config?.configurationError) {
|
||||||
|
console.log('Configuration error', $config);
|
||||||
|
internalRedirectTo(`/error.html`);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root theme-light theme-type-light">
|
<div class="root theme-light theme-type-light">
|
||||||
|
|||||||
Reference in New Issue
Block a user