Skip to content

Commit

Permalink
feat: use 0.0.0.0 as the default listening address for RPC and gnoweb
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl committed Feb 14, 2024
1 parent 0cce745 commit b478455
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion docs/getting-started/setting-up-a-local-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ gnoland start --chainid NewChainID
```

We can verify the chain ID has been changed, by fetching the status of the node and seeing the
associated chain ID. By default, the node exposes the JSON-RPC API on `http://127.0.0.1:26657`:
associated chain ID. By default, the node exposes the JSON-RPC API on `http://0.0.0.0:26657`[^1]:

```bash
curl -H "Content-type: application/json" -d '{
Expand Down Expand Up @@ -140,3 +140,7 @@ Following this pattern, potential entries into the genesis balances file would l
g1qpymzwx4l4cy6cerdyajp9ksvjsf20rk5y9rtt=10000000000ugnot
g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq=10000000000ugnot
```

[^1]: The address `0.0.0.0` means that the node can be accessed by any IPv4 address,
including any loopback address like `127.0.0.1`, a private network address like
`192.168.0.X`, or a public IP address.
2 changes: 1 addition & 1 deletion gno.land/cmd/gnoweb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func runMain(args []string) error {
fs.StringVar(&cfg.HelpChainID, "help-chainid", cfg.HelpChainID, "help page's chainid")
fs.StringVar(&cfg.HelpRemote, "help-remote", cfg.HelpRemote, "help page's remote addr")
fs.BoolVar(&cfg.WithAnalytics, "with-analytics", cfg.WithAnalytics, "enable privacy-first analytics")
fs.StringVar(&bindAddress, "bind", "127.0.0.1:8888", "server listening address")
fs.StringVar(&bindAddress, "bind", ":8888", "server listening address")

if err := fs.Parse(args); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/bft/rpc/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type RPCConfig struct {
// DefaultRPCConfig returns a default configuration for the RPC server
func DefaultRPCConfig() *RPCConfig {
return &RPCConfig{
ListenAddress: "tcp://127.0.0.1:26657",
ListenAddress: "tcp://0.0.0.0:26657",

Check warning on line 91 in tm2/pkg/bft/rpc/config/config.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/bft/rpc/config/config.go#L91

Added line #L91 was not covered by tests
CORSAllowedOrigins: []string{"*"},
CORSAllowedMethods: []string{http.MethodHead, http.MethodGet, http.MethodPost, http.MethodOptions},
CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"},
Expand Down

0 comments on commit b478455

Please sign in to comment.