From 75c6396b3f344891419aaa90770ee43cb0417f5e Mon Sep 17 00:00:00 2001 From: Helder Moreira Date: Fri, 25 Mar 2022 13:44:34 +0000 Subject: [PATCH] feat: allow configuring home dir (#16) --- README.md | 1 + cmd/faucet/config.go | 5 +++++ cmd/faucet/main.go | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index fa4a888..6397240 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ shows the available configuration options and respective defaults: | keyring-backend | KEYRING_BACKEND | keyring backend to be used | | | legacy-send | LEGACY_SEND | whether to use legacy send command | false | | coin-type | COIN_TYPE | registered coin type number for HD derivation (BIP-0044) | 118 | +| home | HOME | replaces the default home used by the chain | | | | | | | ### [gaia](https://github.com/cosmos/gaia) example diff --git a/cmd/faucet/config.go b/cmd/faucet/config.go index 73595df..16d7757 100644 --- a/cmd/faucet/config.go +++ b/cmd/faucet/config.go @@ -26,6 +26,7 @@ var ( nodeAddress string legacySendCmd bool coinType string + home string ) func init() { @@ -82,4 +83,8 @@ func init() { environ.GetString("COIN_TYPE", "118"), "registered coin type number for HD derivation (BIP-0044), defaults from (satoshilabs/SLIP-0044)", ) + flag.StringVar(&home, "home", + environ.GetString("HOME", ""), + "replaces the default home used by the chain", + ) } diff --git a/cmd/faucet/main.go b/cmd/faucet/main.go index 0de62dd..2bcfbe8 100644 --- a/cmd/faucet/main.go +++ b/cmd/faucet/main.go @@ -30,6 +30,10 @@ func main() { chaincmd.WithNodeAddress(nodeAddress), } + if home != "" { + ccoptions = append(ccoptions, chaincmd.WithHome(home)) + } + if legacySendCmd { ccoptions = append(ccoptions, chaincmd.WithLegacySendCommand()) } @@ -48,6 +52,9 @@ func main() { chaincmd.WithVersion(cosmosver.MaxLaunchpadVersion), chaincmd.WithLaunchpadCLI(appCli), ) + if home != "" { + ccoptions = append(ccoptions, chaincmd.WithLaunchpadCLIHome(home)) + } default: ccoptions = append(ccoptions, chaincmd.WithVersion(cosmosver.Latest),