mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 17:55:59 +00:00
config error detection
This commit is contained in:
@@ -39,6 +39,12 @@ module.exports = {
|
|||||||
? await connections.getCore({ conid: singleConid })
|
? await connections.getCore({ conid: singleConid })
|
||||||
: connections.singleConnection;
|
: connections.singleConnection;
|
||||||
|
|
||||||
|
let configurationError = null;
|
||||||
|
if (process.env.STORAGE_DATABASE && process.env.BASIC_AUTH) {
|
||||||
|
configurationError =
|
||||||
|
'Basic authentization is not allowed, when using storage. Cannot use both STORAGE_DATABASE and BASIC_AUTH';
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
runAsPortal: !!connections.portalConnections,
|
runAsPortal: !!connections.portalConnections,
|
||||||
singleDbConnection: connections.singleDbConnection,
|
singleDbConnection: connections.singleDbConnection,
|
||||||
@@ -51,6 +57,7 @@ module.exports = {
|
|||||||
isElectron: platformInfo.isElectron,
|
isElectron: platformInfo.isElectron,
|
||||||
isLicenseValid: platformInfo.isLicenseValid,
|
isLicenseValid: platformInfo.isLicenseValid,
|
||||||
checkedLicense: platformInfo.checkedLicense,
|
checkedLicense: platformInfo.checkedLicense,
|
||||||
|
configurationError,
|
||||||
logoutUrl: await authProvider.getLogoutUrl(),
|
logoutUrl: await authProvider.getLogoutUrl(),
|
||||||
permissions,
|
permissions,
|
||||||
login,
|
login,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ function start() {
|
|||||||
|
|
||||||
const server = http.createServer(app);
|
const server = http.createServer(app);
|
||||||
|
|
||||||
if (process.env.BASIC_AUTH) {
|
if (process.env.BASIC_AUTH && !process.env.STORAGE_DATABASE) {
|
||||||
async function authorizer(username, password, cb) {
|
async function authorizer(username, password, cb) {
|
||||||
try {
|
try {
|
||||||
const resp = await getDefaultAuthProvider().login(username, password);
|
const resp = await getDefaultAuthProvider().login(username, password);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
<ErrorInfo
|
<ErrorInfo
|
||||||
message={`Invalid license. Please contact sales@dbgate.eu for more details. ${$config?.checkedLicense?.error}`}
|
message={`Invalid license. Please contact sales@dbgate.eu for more details. ${$config?.checkedLicense?.error}`}
|
||||||
/>
|
/>
|
||||||
|
{:else if $config?.configurationError}
|
||||||
|
<ErrorInfo message={$config?.configurationError} />
|
||||||
{:else if error}
|
{:else if error}
|
||||||
<ErrorInfo message={error} />
|
<ErrorInfo message={error} />
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export function handleOauthCallback() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function handleAuthOnStartup(config, isAdminPage = false) {
|
export async function handleAuthOnStartup(config, isAdminPage = false) {
|
||||||
if (!config.isLicenseValid) {
|
if (!config.isLicenseValid || config.configurationError) {
|
||||||
internalRedirectTo(`/?page=error`);
|
internalRedirectTo(`/?page=error`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user