Configure all tool (#5080)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-03-27 21:37:42 +05:00 committed by GitHub
parent a5d51a7fd1
commit c8b8f9f657
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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>', 'Enable plugin configuration', '')
.option('--disable <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 <workspace>')
.description('optimize model')