Skip to content

Commit

Permalink
Merge PR #3453: Make rest-server respect persistent flags
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio authored and cwgoes committed Jan 31, 2019
1 parent bc193df commit f4cf45e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 2 additions & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ BUG FIXES
https://github.com/ZondaX/ledger-cosmos-go/commit/ed9aa39ce8df31bad1448c72d3d226bf2cb1a8d1 in order to fix a derivation path issue that causes `gaiacli keys add --recover`
to malfunction.
- [\#3419](https://github.com/cosmos/cosmos-sdk/pull/3419) Fix `q distr slashes` panic
- [\#3453](https://github.com/cosmos/cosmos-sdk/pull/3453) The `rest-server` command didn't respect persistent flags such as `--chain-id` and `--trust-node` if they were
passed on the command line.

* Gaia

Expand Down
8 changes: 1 addition & 7 deletions client/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,15 @@ func PostCommands(cmds ...*cobra.Command) []*cobra.Command {

// RegisterRestServerFlags registers the flags required for rest server
func RegisterRestServerFlags(cmd *cobra.Command) *cobra.Command {
cmd = GetCommands(cmd)[0]
cmd.Flags().String(FlagListenAddr, "tcp://localhost:1317", "The address for the server to listen on")
cmd.Flags().Bool(FlagInsecure, false, "Do not set up SSL/TLS layer")
cmd.Flags().String(FlagSSLHosts, "", "Comma-separated hostnames and IPs to generate a certificate for")
cmd.Flags().String(FlagSSLCertFile, "", "Path to a SSL certificate file. If not supplied, a self-signed certificate will be generated.")
cmd.Flags().String(FlagSSLKeyFile, "", "Path to a key file; ignored if a certificate file is not supplied.")
cmd.Flags().String(FlagCORS, "", "Set the domains that can make CORS requests (* for all)")
cmd.Flags().String(FlagChainID, "", "Chain ID of Tendermint node")
cmd.Flags().String(FlagNode, "tcp://localhost:26657", "Address of the node to connect to")
cmd.Flags().Int(FlagMaxOpenConnections, 1000, "The number of maximum open connections")
cmd.Flags().Bool(FlagTrustNode, false, "Trust connected full node (don't verify proofs for responses)")
cmd.Flags().Bool(FlagIndentResponse, false, "Add indent to JSON response")

viper.BindPFlag(FlagTrustNode, cmd.Flags().Lookup(FlagTrustNode))
viper.BindPFlag(FlagChainID, cmd.Flags().Lookup(FlagChainID))
viper.BindPFlag(FlagNode, cmd.Flags().Lookup(FlagNode))
return cmd
}

Expand Down
7 changes: 3 additions & 4 deletions client/lcd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ func (rs *RestServer) Start(listenAddr string, sslHosts string,
if err != nil {
return
}
rs.log.Info("Starting Gaia Lite REST service...")
rs.log.Info(fmt.Sprintf("Starting Gaia Lite REST service (chain-id: %q)...",
viper.GetString(client.FlagChainID)))

// launch rest-server in insecure mode
if insecure {
Expand Down Expand Up @@ -151,9 +152,7 @@ func ServeCommand(cdc *codec.Codec, registerRoutesFn func(*RestServer)) *cobra.C
},
}

client.RegisterRestServerFlags(cmd)

return cmd
return client.RegisterRestServerFlags(cmd)
}

func (rs *RestServer) registerSwaggerUI() {
Expand Down

0 comments on commit f4cf45e

Please sign in to comment.