Skip to content

Commit

Permalink
Merge pull request ethereum#242 from OffchainLabs/auth-rpc-params
Browse files Browse the repository at this point in the history
add AuthModules and AuthOrigins params to stack config
  • Loading branch information
Tristan-Wilson authored Aug 10, 2023
2 parents d6778f2 + e66eafe commit 82ab511
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
10 changes: 10 additions & 0 deletions node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ type Config struct {
// for the authenticated api. This is by default {'localhost'}.
AuthVirtualHosts []string `toml:",omitempty"`

// AuthModules is a list of API modules to expose via the Auth RPC interface.
// If the module list is empty, all RPC API endpoints designated public will be
// exposed.
AuthModules []string

// AuthOrigins is the list of domain to accept websocket requests from. Please be
// aware that the server can only act upon the HTTP request the client sends and
// cannot verify the validity of the request header.
AuthOrigins []string `toml:",omitempty"`

// WSHost is the host interface on which to start the websocket RPC server. If
// this field is empty, no websocket API endpoint will be started.
WSHost string
Expand Down
2 changes: 2 additions & 0 deletions node/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ var DefaultConfig = Config{
AuthAddr: DefaultAuthHost,
AuthPort: DefaultAuthPort,
AuthVirtualHosts: DefaultAuthVhosts,
AuthModules: DefaultAuthModules,
AuthOrigins: DefaultAuthOrigins,
HTTPModules: []string{"net", "web3"},
HTTPVirtualHosts: []string{"localhost"},
HTTPTimeouts: rpc.DefaultHTTPTimeouts,
Expand Down
6 changes: 3 additions & 3 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (n *Node) startRPC() error {
if err := server.enableRPC(allAPIs, httpConfig{
CorsAllowedOrigins: DefaultAuthCors,
Vhosts: n.config.AuthVirtualHosts,
Modules: DefaultAuthModules,
Modules: n.config.AuthModules,
prefix: DefaultAuthPrefix,
jwtSecret: secret,
}); err != nil {
Expand All @@ -463,8 +463,8 @@ func (n *Node) startRPC() error {
return err
}
if err := server.enableWS(allAPIs, wsConfig{
Modules: DefaultAuthModules,
Origins: DefaultAuthOrigins,
Modules: n.config.AuthModules,
Origins: n.config.AuthOrigins,
prefix: DefaultAuthPrefix,
jwtSecret: secret,
}); err != nil {
Expand Down

0 comments on commit 82ab511

Please sign in to comment.