forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional flag to
gaiad testnet
to make config directory of daem…
…on and cli configurable, fixes cosmos#1992
- Loading branch information
1 parent
d27c5ee
commit 7d70300
Showing
2 changed files
with
19 additions
and
9 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 |
---|---|---|
|
@@ -18,9 +18,11 @@ import ( | |
) | ||
|
||
var ( | ||
nodeDirPrefix = "node-dir-prefix" | ||
nValidators = "v" | ||
outputDir = "o" | ||
nodeDirPrefix = "node-dir-prefix" | ||
nValidators = "v" | ||
outputDir = "o" | ||
nodeDaemonHome = "node-daemon-home" | ||
nodeCliHome = "node-cli-home" | ||
|
||
startingIPAddress = "starting-ip-address" | ||
) | ||
|
@@ -39,7 +41,7 @@ Note, strict routability for addresses is turned off in the config file. | |
Example: | ||
gaiad testnet --v 4 --output-dir ./output --starting-ip-address 192.168.10.2 | ||
gaiad testnet --v 4 --o ./output --starting-ip-address 192.168.10.2 | ||
`, | ||
RunE: func(_ *cobra.Command, _ []string) error { | ||
config := ctx.Config | ||
|
@@ -53,6 +55,10 @@ Example: | |
"Directory to store initialization data for the testnet") | ||
cmd.Flags().String(nodeDirPrefix, "node", | ||
"Prefix the directory name for each node with (node results in node0, node1, ...)") | ||
cmd.Flags().String(nodeDaemonHome, "gaiad", | ||
"Home directory of the node's daemon configuration") | ||
cmd.Flags().String(nodeCliHome, "gaiacli", | ||
"Home directory of the node's cli configuration") | ||
|
||
cmd.Flags().String(startingIPAddress, "192.168.0.1", | ||
"Starting IP address (192.168.0.1 results in persistent peers list [email protected]:46656, [email protected]:46656, ...)") | ||
|
@@ -66,8 +72,10 @@ func testnetWithConfig(config *cfg.Config, cdc *wire.Codec, appInit AppInit) err | |
// Generate private key, node ID, initial transaction | ||
for i := 0; i < numValidators; i++ { | ||
nodeDirName := fmt.Sprintf("%s%d", viper.GetString(nodeDirPrefix), i) | ||
nodeDir := filepath.Join(outDir, nodeDirName, "gaiad") | ||
clientDir := filepath.Join(outDir, nodeDirName, "gaiacli") | ||
nodeDaemonHomeName := viper.GetString(nodeDaemonHome) | ||
nodeCliHomeName := viper.GetString(nodeCliHome) | ||
nodeDir := filepath.Join(outDir, nodeDirName, nodeDaemonHomeName) | ||
clientDir := filepath.Join(outDir, nodeDirName, nodeCliHomeName) | ||
gentxsDir := filepath.Join(outDir, "gentxs") | ||
config.SetRoot(nodeDir) | ||
|
||
|
@@ -122,7 +130,8 @@ func testnetWithConfig(config *cfg.Config, cdc *wire.Codec, appInit AppInit) err | |
for i := 0; i < numValidators; i++ { | ||
|
||
nodeDirName := fmt.Sprintf("%s%d", viper.GetString(nodeDirPrefix), i) | ||
nodeDir := filepath.Join(outDir, nodeDirName, "gaiad") | ||
nodeDaemonHomeName := viper.GetString(nodeDaemonHome) | ||
nodeDir := filepath.Join(outDir, nodeDirName, nodeDaemonHomeName) | ||
gentxsDir := filepath.Join(outDir, "gentxs") | ||
initConfig := InitConfig{ | ||
chainID, | ||
|