From 8032d951ae452abc03f1a83d230af778686cb780 Mon Sep 17 00:00:00 2001 From: Albert Le Batteux Date: Tue, 11 Apr 2023 19:04:58 +0200 Subject: [PATCH] feat(cli): add listen flag --- gno.land/cmd/gnoland/main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gno.land/cmd/gnoland/main.go b/gno.land/cmd/gnoland/main.go index 9a2c11146e8..17ab6c55a31 100644 --- a/gno.land/cmd/gnoland/main.go +++ b/gno.land/cmd/gnoland/main.go @@ -33,6 +33,7 @@ type gnolandCfg struct { chainID string genesisRemote string rootDir string + rpcListenAddr string } func main() { @@ -105,6 +106,13 @@ func (c *gnolandCfg) RegisterFlags(fs *flag.FlagSet) { "localhost:26657", "replacement for '%%REMOTE%%' in genesis", ) + + fs.StringVar( + &c.rpcListenAddr, + "rpc.laddr", + "tcp://127.0.0.1:26657", + `RPC listen address. Port required (default "tcp://127.0.0.1:26657")`, + ) } func exec(c *gnolandCfg) error { @@ -116,6 +124,10 @@ func exec(c *gnolandCfg) error { cfg.Consensus.CreateEmptyBlocksInterval = 60 * time.Second }) + if c.rpcListenAddr != "tcp://127.0.0.1:26657" { + cfg.RPC.ListenAddress = c.rpcListenAddr + } + // create priv validator first. // need it to generate genesis.json newPrivValKey := cfg.PrivValidatorKeyFile()