diff --git a/packages/api/env/dblogin/.env b/packages/api/env/dblogin/.env index 8ad6626c..5c47a7d0 100644 --- a/packages/api/env/dblogin/.env +++ b/packages/api/env/dblogin/.env @@ -2,6 +2,7 @@ DEVMODE=1 CONNECTIONS=mysql SINGLE_CONNECTION=mysql +# SINGLE_DATABASE=Chinook LABEL_mysql=MySql localhost SERVER_mysql=localhost diff --git a/packages/api/env/singledb/.env b/packages/api/env/singledb/.env index cf816aa1..a119453b 100644 --- a/packages/api/env/singledb/.env +++ b/packages/api/env/singledb/.env @@ -5,8 +5,8 @@ CONNECTIONS=mysql LABEL_mysql=MySql localhost SERVER_mysql=localhost USER_mysql=root -PASSWORD_mysql=test -PORT_mysql=3307 +PASSWORD_mysql=Pwd2020Db +PORT_mysql=3306 ENGINE_mysql=mysql@dbgate-plugin-mysql DBCONFIG_mysql=[{"name":"Chinook","connectionColor":"cyan"}] diff --git a/packages/api/src/controllers/config.js b/packages/api/src/controllers/config.js index 0187fc4f..500f6142 100644 --- a/packages/api/src/controllers/config.js +++ b/packages/api/src/controllers/config.js @@ -38,7 +38,7 @@ module.exports = { return { runAsPortal: !!connections.portalConnections, - singleDatabase: connections.singleDatabase, + singleDbConnection: connections.singleDbConnection, singleConnection: connections.singleConnection, // hideAppEditor: !!process.env.HIDE_APP_EDITOR, allowShellConnection: platformInfo.allowShellConnection, diff --git a/packages/api/src/controllers/connections.js b/packages/api/src/controllers/connections.js index 0305f448..7ca5c67b 100644 --- a/packages/api/src/controllers/connections.js +++ b/packages/api/src/controllers/connections.js @@ -133,7 +133,7 @@ function getPortalCollections() { const portalConnections = getPortalCollections(); -function getSingleDatabase() { +function getSingleDbConnection() { if (process.env.SINGLE_CONNECTION && process.env.SINGLE_DATABASE) { // @ts-ignore const connection = portalConnections.find(x => x._id == process.env.SINGLE_CONNECTION); @@ -158,7 +158,7 @@ function getSingleDatabase() { } function getSingleConnection() { - if (getSingleDatabase()) return null; + if (getSingleDbConnection()) return null; if (process.env.SINGLE_CONNECTION) { // @ts-ignore const connection = portalConnections.find(x => x._id == process.env.SINGLE_CONNECTION); @@ -174,13 +174,13 @@ function getSingleConnection() { return null; } -const singleDatabase = getSingleDatabase(); +const singleDbConnection = getSingleDbConnection(); const singleConnection = getSingleConnection(); module.exports = { datastore: null, opened: [], - singleDatabase, + singleDbConnection, singleConnection, portalConnections, diff --git a/packages/web/src/commands/CommandPalette.svelte b/packages/web/src/commands/CommandPalette.svelte index b2adedf6..ba6ae25b 100644 --- a/packages/web/src/commands/CommandPalette.svelte +++ b/packages/web/src/commands/CommandPalette.svelte @@ -40,7 +40,7 @@ for (const connection of connectionList || []) { const conid = connection._id; if (connection.singleDatabase) continue; - if (getCurrentConfig()?.singleDatabase) continue; + if (getCurrentConfig()?.singleDbConnection) continue; const databases = getLocalStorage(`database_list_${conid}`) || []; for (const db of databases) { databaseList.push({ diff --git a/packages/web/src/stores.ts b/packages/web/src/stores.ts index 658ee4f3..b68db116 100644 --- a/packages/web/src/stores.ts +++ b/packages/web/src/stores.ts @@ -246,8 +246,8 @@ export function subscribeApiDependendStores() { useConfig().subscribe(value => { currentConfigValue = value; invalidateCommands(); - if (value.singleDatabase) { - currentDatabase.set(value.singleDatabase); + if (value.singleDbConnection) { + currentDatabase.set(value.singleDbConnection); } }); } diff --git a/packages/web/src/widgets/DatabaseWidget.svelte b/packages/web/src/widgets/DatabaseWidget.svelte index 807fe4ca..2e554bbd 100644 --- a/packages/web/src/widgets/DatabaseWidget.svelte +++ b/packages/web/src/widgets/DatabaseWidget.svelte @@ -21,10 +21,12 @@ $: config = useConfig(); $: singleDatabase = $currentDatabase?.connection?.singleDatabase; $: database = $currentDatabase?.name; + + $: console.log('CFG', $config); - {#if !$config?.singleDatabase} + {#if !$config?.singleDbConnection}