-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Voyager Bot
committed
Jan 11, 2019
1 parent
533e406
commit 85f9b0c
Showing
2 changed files
with
15 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,25 @@ | ||
"use strict" | ||
|
||
let runner = require(`./runner.js`) | ||
let config = require(`../app/src/config.js`) | ||
const fs = require(`fs-extra`) | ||
const { join, resolve } = require(`path`) | ||
const { | ||
startNodes, | ||
buildNodes, | ||
setupAccounts | ||
} = require(`./build/local/helper`) | ||
const { buildNodes } = require(`./build/local/helper`) | ||
const appDir = resolve(`${__dirname}/../`) | ||
const buildTestnetPath = join(appDir, `builds`, `testnets`) | ||
|
||
async function main() { | ||
const network = process.argv[2] || config.default_network | ||
const network = process.argv[2] || `local-testnet` | ||
const numberNodes = parseInt(process.argv[3], 10) || 1 | ||
|
||
let extendedEnv = {} | ||
let networkPath = `./app/networks/${network}/` | ||
|
||
if (network === `local-testnet`) { | ||
const { cliHomePrefix, nodes, mainAccountSignInfo } = await buildNodes( | ||
join(buildTestnetPath, network), | ||
{ | ||
chainId: network, | ||
password: `1234567890`, | ||
overwrite: false, | ||
moniker: `local`, | ||
keyName: `main-account` | ||
}, | ||
numberNodes | ||
) | ||
await startNodes(nodes, mainAccountSignInfo, network) | ||
fs.copySync(join(nodes[1].home, `config`), cliHomePrefix) | ||
let { version } = require(`../package.json`) | ||
fs.writeFileSync(`${cliHomePrefix}/app_version`, version) | ||
networkPath = cliHomePrefix // join(nodes[1].home, `config`) | ||
extendedEnv = { | ||
LCD_URL: `https://localhost:9070`, | ||
RPC_URL: `http://localhost:26657`, | ||
COSMOS_HOME: cliHomePrefix | ||
} | ||
await setupAccounts(nodes[1].cliHome, join(cliHomePrefix, `lcd`), { | ||
keyName: `local-test` | ||
}) | ||
} | ||
|
||
// run Voyager in a development environment | ||
let child = await runner(networkPath, extendedEnv) | ||
|
||
// kill all development processes if master process fails | ||
process.on(`exit`, () => { | ||
child.kill(`SIGKILL`) | ||
}) | ||
child.on(`exit`, () => process.exit()) | ||
await buildNodes( | ||
join(buildTestnetPath, network), | ||
{ | ||
chainId: network, | ||
password: `1234567890`, | ||
overwrite: false, | ||
moniker: `local`, | ||
keyName: `main-account` | ||
}, | ||
numberNodes | ||
) | ||
} | ||
|
||
main().catch(function(error) { | ||
console.error(`Starting the application failed`, error) | ||
}) | ||
main() |