Skip to content

Commit 3822257

Browse files
fix(dot/rpc): include unsafe flags to be considered by RPC layer (#2483)
* fix: include unsafe flags to be considered by RPC layer
1 parent 7a84636 commit 3822257

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

cmd/gossamer/config.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,28 @@ func setDotRPCConfig(ctx *cli.Context, tomlCfg ctoml.RPCConfig, cfg *dot.RPCConf
736736
cfg.External = false
737737
}
738738

739+
// check --rpc-unsafe flag value
740+
if rpcUnsafe := ctx.GlobalBool(RPCUnsafeEnabledFlag.Name); rpcUnsafe {
741+
cfg.Unsafe = true
742+
}
743+
744+
// check --rpc-unsafe-external flag value
745+
if externalUnsafe := ctx.GlobalBool(RPCUnsafeExternalFlag.Name); externalUnsafe {
746+
cfg.Unsafe = true
747+
cfg.UnsafeExternal = true
748+
}
749+
750+
// check --ws-unsafe flag value
751+
if wsUnsafe := ctx.GlobalBool(WSUnsafeEnabledFlag.Name); wsUnsafe {
752+
cfg.WSUnsafe = true
753+
}
754+
755+
// check --ws-unsafe-external flag value
756+
if wsExternalUnsafe := ctx.GlobalBool(WSUnsafeExternalFlag.Name); wsExternalUnsafe {
757+
cfg.WSUnsafe = true
758+
cfg.WSUnsafeExternal = true
759+
}
760+
739761
// check --rpcport flag and update node configuration
740762
if port := ctx.GlobalUint(RPCPortFlag.Name); port != 0 {
741763
cfg.Port = uint32(port)

cmd/gossamer/export.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,18 @@ func dotConfigToToml(dcfg *dot.Config) *ctoml.Config {
119119
}
120120

121121
cfg.RPC = ctoml.RPCConfig{
122-
Enabled: dcfg.RPC.Enabled,
123-
External: dcfg.RPC.External,
124-
Port: dcfg.RPC.Port,
125-
Host: dcfg.RPC.Host,
126-
Modules: dcfg.RPC.Modules,
127-
WSPort: dcfg.RPC.WSPort,
128-
WS: dcfg.RPC.WS,
129-
WSExternal: dcfg.RPC.WSExternal,
122+
Enabled: dcfg.RPC.Enabled,
123+
External: dcfg.RPC.External,
124+
Unsafe: dcfg.RPC.Unsafe,
125+
UnsafeExternal: dcfg.RPC.UnsafeExternal,
126+
Port: dcfg.RPC.Port,
127+
Host: dcfg.RPC.Host,
128+
Modules: dcfg.RPC.Modules,
129+
WSPort: dcfg.RPC.WSPort,
130+
WS: dcfg.RPC.WS,
131+
WSExternal: dcfg.RPC.WSExternal,
132+
WSUnsafe: dcfg.RPC.WSUnsafe,
133+
WSUnsafeExternal: dcfg.RPC.WSUnsafeExternal,
130134
}
131135

132136
return cfg

cmd/gossamer/flags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ var (
287287
Usage: "Enable external websocket connections",
288288
}
289289
// WSFlag Enable the websockets server
290-
WSUnsafeFlag = cli.BoolFlag{
290+
WSUnsafeEnabledFlag = cli.BoolFlag{
291291
Name: "ws-unsafe",
292292
Usage: "Enable access to websocket unsafe calls",
293293
}
@@ -436,7 +436,7 @@ var (
436436
RPCModulesFlag,
437437
WSFlag,
438438
WSExternalFlag,
439-
WSUnsafeFlag,
439+
WSUnsafeEnabledFlag,
440440
WSUnsafeExternalFlag,
441441
WSPortFlag,
442442

0 commit comments

Comments
 (0)