Skip to content
Merged

Dev #405

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/src/services/runCli.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const addCustomMessageInCliLogs = async (loggerPath: string, level: string = 'in
export const runCli = async (rg: string, user_id: string, stack_uid: any, projectId: string, isTest = false, transformePath: string) => {
try {
const message: string = isTest ? 'Test Migration Process Completed' : 'Migration Process Completed'
const regionPresent = CS_REGIONS?.find((item: string) => item === rg) ?? 'NA';
const regionPresent = CS_REGIONS?.find((item: string) => item === rg) ?? 'NA'?.replace?.(/_/g, '-');
const regionCli = regionPresent?.replace?.(/_/g, '-');
await AuthenticationModel.read();
const userData = AuthenticationModel.chain
.get("users")
Expand All @@ -42,7 +43,7 @@ export const runCli = async (rg: string, user_id: string, stack_uid: any, projec
await setLogFilePath(loggerPath);
await watchLogs(loggerPath, transformePath);
shell.cd(path.join(process.cwd(), '..', 'cli', 'packages', 'contentstack'));
shell.exec(`node bin/run config:set:region ${regionPresent}`);
shell.exec(`node bin/run config:set:region ${regionCli}`);
shell.exec(`node bin/run login -a ${userData?.authtoken} -e ${userData?.email}`);
const importData = shell.exec(`node bin/run cm:stacks:import -k ${stack_uid} -d ${sourcePath} --backup-dir=${backupPath} --yes`, { async: true });
importData.on('exit', async (code) => {
Expand Down
Loading
Loading