diff --git a/packages/api/.env b/packages/api/.env index 0c59dcd7..6e8fec36 100644 --- a/packages/api/.env +++ b/packages/api/.env @@ -12,3 +12,4 @@ DEVMODE=1 # LOGIN_PASSWORD_test=test # LOGIN_PERMISSIONS_test=~*, widgets/database +# WORKSPACE_DIR=/home/jena/dbgate-data-2 diff --git a/packages/api/src/utility/directories.js b/packages/api/src/utility/directories.js index 0444c151..5f6de8ec 100644 --- a/packages/api/src/utility/directories.js +++ b/packages/api/src/utility/directories.js @@ -20,8 +20,18 @@ const ensureDirectory = (dir, clean) => { } }; +function datadirCore() { + if (process.env.WORKSPACE_DIR) { + return process.env.WORKSPACE_DIR; + } + if (processArgs.workspaceDir) { + return processArgs.workspaceDir; + } + return path.join(os.homedir(), 'dbgate-data'); +} + function datadir() { - const dir = path.join(os.homedir(), 'dbgate-data'); + const dir = datadirCore(); ensureDirectory(dir); return dir; diff --git a/packages/api/src/utility/processArgs.js b/packages/api/src/utility/processArgs.js index f1a0ab00..3b5dc2c5 100644 --- a/packages/api/src/utility/processArgs.js +++ b/packages/api/src/utility/processArgs.js @@ -10,6 +10,7 @@ const checkParent = process.argv.includes('--checkParent'); const startProcess = getNamedArg('--start-process'); const isForkedApi = process.argv.includes('--is-forked-api'); const pluginsDir = getNamedArg('--plugins-dir'); +const workspaceDir = getNamedArg('--workspace-dir'); function getPassArgs() { const res = []; @@ -28,4 +29,5 @@ module.exports = { isForkedApi, getPassArgs, pluginsDir, + workspaceDir, }; diff --git a/packages/web/src/commands/CommandPalette.svelte b/packages/web/src/commands/CommandPalette.svelte index b29b5c54..b83a4ea0 100644 --- a/packages/web/src/commands/CommandPalette.svelte +++ b/packages/web/src/commands/CommandPalette.svelte @@ -39,6 +39,8 @@ const databaseList = []; for (const connection of connectionList || []) { const conid = connection._id; + if (connection.singleDatabase) continue; + if (getCurrentConfig()?.singleDatabase) continue; const databases = getLocalStorage(`database_list_${conid}`) || []; for (const db of databases) { databaseList.push({ @@ -65,9 +67,9 @@ import { databaseObjectIcons, handleDatabaseObjectClick } from '../appobj/DatabaseObjectAppObject.svelte'; import FontIcon from '../icons/FontIcon.svelte'; import { - commands, commandsCustomized, currentDatabase, + getCurrentConfig, getVisibleCommandPalette, visibleCommandPalette, } from '../stores';