mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Allow to backup and skip domain (#4077)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
704503ef12
commit
fb4cdfba5e
@ -342,9 +342,15 @@ export function devTool (
|
|||||||
program
|
program
|
||||||
.command('backup <dirName> <workspace>')
|
.command('backup <dirName> <workspace>')
|
||||||
.description('dump workspace transactions and minio resources')
|
.description('dump workspace transactions and minio resources')
|
||||||
.action(async (dirName: string, workspace: string, cmd) => {
|
.option('-s, --skip <skip>', 'A list of ; separated domain names to skip during backup', '')
|
||||||
|
.action(async (dirName: string, workspace: string, cmd: { skip: string }) => {
|
||||||
const storage = await createFileBackupStorage(dirName)
|
const storage = await createFileBackupStorage(dirName)
|
||||||
await backup(transactorUrl, getWorkspaceId(workspace, productId), storage)
|
await backup(
|
||||||
|
transactorUrl,
|
||||||
|
getWorkspaceId(workspace, productId),
|
||||||
|
storage,
|
||||||
|
(cmd.skip ?? '').split(';').map((it) => it.trim())
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
program
|
program
|
||||||
|
@ -327,7 +327,12 @@ export async function cloneWorkspace (
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function backup (transactorUrl: string, workspaceId: WorkspaceId, storage: BackupStorage): Promise<void> {
|
export async function backup (
|
||||||
|
transactorUrl: string,
|
||||||
|
workspaceId: WorkspaceId,
|
||||||
|
storage: BackupStorage,
|
||||||
|
skipDomains: string[] = []
|
||||||
|
): Promise<void> {
|
||||||
const connection = (await connect(transactorUrl, workspaceId, undefined, {
|
const connection = (await connect(transactorUrl, workspaceId, undefined, {
|
||||||
mode: 'backup'
|
mode: 'backup'
|
||||||
})) as unknown as CoreClient & BackupClient
|
})) as unknown as CoreClient & BackupClient
|
||||||
@ -337,7 +342,7 @@ export async function backup (transactorUrl: string, workspaceId: WorkspaceId, s
|
|||||||
...connection
|
...connection
|
||||||
.getHierarchy()
|
.getHierarchy()
|
||||||
.domains()
|
.domains()
|
||||||
.filter((it) => it !== DOMAIN_TRANSIENT && it !== DOMAIN_MODEL)
|
.filter((it) => it !== DOMAIN_TRANSIENT && it !== DOMAIN_MODEL && !skipDomains.includes(it))
|
||||||
]
|
]
|
||||||
console.log('domains for dump', domains.length)
|
console.log('domains for dump', domains.length)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user