Skip to content

Commit

Permalink
fix(orchestrator): inject the chain into generators
Browse files Browse the repository at this point in the history
  • Loading branch information
pepoviola committed Nov 18, 2023
1 parent 3bbb68f commit c638101
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions javascript/packages/orchestrator/src/paras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ export async function generateParachainFiles(
? chainSpecFullPath
: `${client.remoteDir}/${chainSpecFileName}`;

genesisStateGenerator = genesisStateGenerator.replace(
" > ",
` --chain ${chainSpecPathInNode} > `,
genesisStateGenerator = injectChainInCmd(
genesisStateGenerator,
chainSpecPathInNode!,
);
}
commands.push(`${genesisStateGenerator}-${parachain.id}`);
Expand All @@ -255,9 +255,9 @@ export async function generateParachainFiles(
? chainSpecFullPath
: `${client.remoteDir}/${chainSpecFileName}`;

genesisWasmGenerator = genesisWasmGenerator.replace(
" > ",
` --chain ${chainSpecPathInNode} > `,
genesisWasmGenerator = injectChainInCmd(
genesisWasmGenerator,
chainSpecPathInNode!,
);
}
commands.push(`${genesisWasmGenerator}-${parachain.id}`);
Expand Down Expand Up @@ -349,3 +349,11 @@ function getChainSpecCmdRaw(chainSpecCommand: string) {

return returnCmd;
}

function injectChainInCmd(cmd: string, chain: string): string {
const parts = cmd.split(" ");
const l = parts.length;
const index = parts[l - 1] == ">" ? l - 2 : l - 1;
parts.splice(index, 0, `--chain ${chain}`);
return parts.join(" ");
}

0 comments on commit c638101

Please sign in to comment.