From 8682556fad5ab71defd16c6e983d16150f42a731 Mon Sep 17 00:00:00 2001 From: philipstanislaus Date: Wed, 12 Sep 2018 10:02:03 +0200 Subject: [PATCH] Merge PR #1993: Add optional flag to `gaiad testnet` to make config directory of daemon and cli configurable --- PENDING.md | 2 +- server/testnet.go | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/PENDING.md b/PENDING.md index d1d25c827..b313f5cf6 100644 --- a/PENDING.md +++ b/PENDING.md @@ -47,7 +47,6 @@ BREAKING CHANGES * Tendermint - FEATURES * Gaia REST API (`gaiacli advanced rest-server`) @@ -111,6 +110,7 @@ IMPROVEMENTS * [simulation] Make logs not just pure strings, speeding it up by a large factor at greater block heights \#2282 * [simulation] Add a concept of weighting the operations \#2303 * [simulation] Logs get written to file if large, and also get printed on panics \#2285 + * [gaiad] \#1992 Add optional flag to `gaiad testnet` to make config directory of daemon (default `gaiad`) and cli (default `gaiacli`) configurable * Tendermint diff --git a/server/testnet.go b/server/testnet.go index 93f563005..951e378d1 100644 --- a/server/testnet.go +++ b/server/testnet.go @@ -18,9 +18,11 @@ import ( ) var ( - nodeDirPrefix = "node-dir-prefix" - nValidators = "v" - outputDir = "output-dir" + nodeDirPrefix = "node-dir-prefix" + nValidators = "v" + outputDir = "output-dir" + 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 ID0@192.168.0.1:46656, ID1@192.168.0.2: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,