From d041f88a473cadedc74ebbd8e5ab7b7ac5135e6b Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 21 Apr 2022 19:08:33 +0200 Subject: [PATCH] dockerhost hint on GUI --- packages/api/src/controllers/config.js | 1 + packages/web/src/modals/ConnectionModal.svelte | 9 +++++++-- .../web/src/modals/ConnectionModalDriverFields.svelte | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/api/src/controllers/config.js b/packages/api/src/controllers/config.js index acd61ccc..bf9f649a 100644 --- a/packages/api/src/controllers/config.js +++ b/packages/api/src/controllers/config.js @@ -37,6 +37,7 @@ module.exports = { // hideAppEditor: !!process.env.HIDE_APP_EDITOR, allowShellConnection: platformInfo.allowShellConnection, allowShellScripting: platformInfo.allowShellConnection, + isDocker: platformInfo.isDocker, permissions, login, ...currentVersion, diff --git a/packages/web/src/modals/ConnectionModal.svelte b/packages/web/src/modals/ConnectionModal.svelte index f853e5af..080ec5d9 100644 --- a/packages/web/src/modals/ConnectionModal.svelte +++ b/packages/web/src/modals/ConnectionModal.svelte @@ -17,7 +17,7 @@ import ErrorMessageModal from './ErrorMessageModal.svelte'; import { writable } from 'svelte/store'; import FormProviderCore from '../forms/FormProviderCore.svelte'; - import { extensions } from '../stores'; + import { extensions, getCurrentConfig } from '../stores'; import _ from 'lodash'; import { getDatabaseFileLabel } from '../utility/getConnectionLabel'; import { apiCall } from '../utility/api'; @@ -27,7 +27,12 @@ let isTesting; let sqlConnectResult; - const values = writable(connection || { server: 'localhost', engine: 'mssql@dbgate-plugin-mssql' }); + const values = writable( + connection || { + server: getCurrentConfig().isDocker ? 'dockerhost' : 'localhost', + engine: 'mssql@dbgate-plugin-mssql', + } + ); $: engine = $values.engine; $: driver = $extensions.drivers.find(x => x.engine == engine); diff --git a/packages/web/src/modals/ConnectionModalDriverFields.svelte b/packages/web/src/modals/ConnectionModalDriverFields.svelte index 0d1dc6ac..761aa0d7 100644 --- a/packages/web/src/modals/ConnectionModalDriverFields.svelte +++ b/packages/web/src/modals/ConnectionModalDriverFields.svelte @@ -10,10 +10,11 @@ import FormSelectField from '../forms/FormSelectField.svelte'; import FormTextField from '../forms/FormTextField.svelte'; - import { extensions } from '../stores'; + import { extensions, getCurrentConfig } from '../stores'; import getElectron from '../utility/getElectron'; import { useAuthTypes } from '../utility/metadataLoaders'; import FormColorField from '../forms/FormColorField.svelte'; + import FontIcon from '../icons/FontIcon.svelte'; const { values } = getFormContext(); const electron = getElectron(); @@ -101,6 +102,12 @@ {/if} + {#if getCurrentConfig().isDocker} +
+ + Under docker, localhost and 127.0.0.1 will not work, use dockerhost instead +
+ {/if} {/if} {#if showUser && showPassword}