show storage connection error

This commit is contained in:
SPRINX0\prochazka 2024-10-17 11:56:24 +02:00
parent 39b99ecf8f
commit ec3c224f44
3 changed files with 24 additions and 5 deletions

View File

@ -17,6 +17,7 @@ const { checkLicense, checkLicenseKey } = require('../utility/checkLicense');
const storage = require('./storage');
const { getAuthProxyUrl } = require('../utility/authProxy');
const { getPublicHardwareFingerprint } = require('../utility/hardwareFingerprint');
const { extractErrorMessage } = require('dbgate-tools');
const lock = new AsyncLock();
@ -39,8 +40,10 @@ module.exports = {
const isUserLoggedIn = authProvider.isUserLoggedIn(req);
const singleConid = authProvider.getSingleConnectionId(req);
const storageConnectionError = storage.getStorageConnectionError();
const singleConnection = singleConid
const singleConnection =
singleConid && !storageConnectionError
? await connections.getCore({ conid: singleConid })
: connections.singleConnection;
@ -50,8 +53,13 @@ module.exports = {
'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 logoutUrl = storageConnectionError ? null : await authProvider.getLogoutUrl();
return {
runAsPortal: !!connections.portalConnections,
@ -68,7 +76,7 @@ module.exports = {
trialDaysLeft: checkedLicense?.isGeneratedTrial && !checkedLicense?.isExpired ? checkedLicense?.daysLeft : null,
checkedLicense,
configurationError,
logoutUrl: await authProvider.getLogoutUrl(),
logoutUrl,
permissions,
login,
// ...additionalConfigProps,

View File

@ -17,4 +17,8 @@ module.exports = {
async getConnectionsForLoginPage() {
return null;
},
getStorageConnectionError() {
return null;
}
};

View File

@ -125,6 +125,13 @@
}
internalRedirectTo(`/not-logged.html`);
}
$: {
if ($config?.configurationError) {
console.log('Configuration error', $config);
internalRedirectTo(`/error.html`);
}
}
</script>
<div class="root theme-light theme-type-light">