Skip to content

Commit

Permalink
chore: In gnodev, include gnoweb flags (#2135)
Browse files Browse the repository at this point in the history
Co-authored-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
jefft0 and gfanton authored Jun 12, 2024
1 parent e2e0611 commit e3f33a2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 20 deletions.
14 changes: 12 additions & 2 deletions contribs/gnodev/cmd/gnodev/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var (

type devCfg struct {
// Listeners
webListenerAddr string
nodeRPCListenerAddr string
nodeP2PListenerAddr string
nodeProxyAppListenerAddr string
Expand All @@ -51,6 +50,10 @@ type devCfg struct {
balancesFile string
txsFile string

// Web Configuration
webListenerAddr string
webRemoteHelperAddr string

// Node Configuration
minimal bool
verbose bool
Expand Down Expand Up @@ -114,7 +117,14 @@ func (c *devCfg) RegisterFlags(fs *flag.FlagSet) {
&c.webListenerAddr,
"web-listener",
defaultDevOptions.webListenerAddr,
"web server listening address",
"web server listener address",
)

fs.StringVar(
&c.webRemoteHelperAddr,
"web-help-remote",
defaultDevOptions.webRemoteHelperAddr,
"web server help page's remote addr (default to <node-rpc-listener>)",
)

fs.StringVar(
Expand Down
10 changes: 8 additions & 2 deletions contribs/gnodev/cmd/gnodev/setup_web.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ import (
// setupGnowebServer initializes and starts the Gnoweb server.
func setupGnoWebServer(logger *slog.Logger, cfg *devCfg, dnode *gnodev.Node) http.Handler {
webConfig := gnoweb.NewDefaultConfig()
webConfig.RemoteAddr = dnode.GetRemoteAddress()
webConfig.HelpRemote = dnode.GetRemoteAddress()

webConfig.HelpChainID = cfg.chainId
webConfig.RemoteAddr = dnode.GetRemoteAddress()
webConfig.HelpRemote = cfg.webRemoteHelperAddr

// If `HelpRemote` is empty default it to `RemoteAddr`
if webConfig.HelpRemote == "" {
webConfig.HelpRemote = webConfig.RemoteAddr
}

app := gnoweb.MakeApp(logger, webConfig)
return app.Router
Expand Down
33 changes: 17 additions & 16 deletions docs/gno-tooling/cli/gnodev.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,20 @@ While `gnodev` is running, the following shortcuts are available:

### Options

| Flag | Effect |
|---------------------|------------------------------------------------------------|
| --minimal | Start `gnodev` without loading the examples folder. |
| --no-watch | Disable hot reload. |
| --add-account | Pre-add account(s) in the form `<bech32>[=<amount>]` |
| --balances-file | Load a balance for the user(s) from a balance file. |
| --chain-id | Set node ChainID |
| --deploy-key | Default key name or Bech32 address for uploading packages. |
| --home | Set the path to load user's Keybase. |
| --max-gas | Set the maximum gas per block |
| --no-replay | Do not replay previous transactions upon reload |
| --node-rpc-listener | listening address for GnoLand RPC node |
| --root | gno root directory |
| --server-mode | disable interaction, and adjust logging for server use. |
| --verbose | enable verbose output for development |
| --web-listener | web server listening address |
| Flag | Effect |
|---------------------|---------------------------------------------------------------------|
| --minimal | Start `gnodev` without loading the examples folder. |
| --no-watch | Disable hot reload. |
| --add-account | Pre-add account(s) in the form `<bech32>[=<amount>]` |
| --balances-file | Load a balance for the user(s) from a balance file. |
| --chain-id | Set node ChainID |
| --deploy-key | Default key name or Bech32 address for uploading packages. |
| --home | Set the path to load user's Keybase. |
| --max-gas | Set the maximum gas per block |
| --no-replay | Do not replay previous transactions upon reload |
| --node-rpc-listener | listening address for GnoLand RPC node |
| --root | gno root directory |
| --server-mode | disable interaction, and adjust logging for server use. |
| --verbose | enable verbose output for development |
| --web-listener | web server listening address |
| --web-help-remote | web server help page's remote addr - default to <node-rpc-listener> |

0 comments on commit e3f33a2

Please sign in to comment.