From c8b8f9f657229ea41a4373fd5ee388dd0c193cc2 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Wed, 27 Mar 2024 21:37:42 +0500 Subject: [PATCH] Configure all tool (#5080) Signed-off-by: Denis Bykhov --- dev/tool/src/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dev/tool/src/index.ts b/dev/tool/src/index.ts index 616f59cbac..5cbc0fe191 100644 --- a/dev/tool/src/index.ts +++ b/dev/tool/src/index.ts @@ -690,6 +690,25 @@ export function devTool ( await changeConfiguration(getWorkspaceId(workspace, productId), transactorUrl, cmd) }) + program + .command('configure-all') + .description('configure all spaces') + .option('--enable ', 'Enable plugin configuration', '') + .option('--disable ', 'Disable plugin configuration', '') + .option('--list', 'List plugin states', false) + .action(async (cmd: { enable: string, disable: string, list: boolean }) => { + const { mongodbUri } = prepareTools() + await withDatabase(mongodbUri, async (db) => { + console.log('configure all workspaces') + console.log(JSON.stringify(cmd)) + const workspaces = await listWorkspacesRaw(db, productId) + for (const ws of workspaces) { + console.log('configure', ws.workspaceName ?? ws.workspace) + await changeConfiguration(getWorkspaceId(ws.workspaceUrl ?? ws.workspace, productId), transactorUrl, cmd) + } + }) + }) + program .command('optimize-model ') .description('optimize model')