aboutsummaryrefslogtreecommitdiffstats
path: root/node/api.go
diff options
context:
space:
mode:
authorbas-vk <bas-vk@users.noreply.github.com>2017-04-13 05:04:14 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-04-13 05:04:14 +0800
commit5e29f4be935ff227bbf07a0c6e80e8809f5e0202 (patch)
tree18e1ef8db3c66c3bf777dc90326aa971f1343d34 /node/api.go
parent43671067fb453a1ed798bcc3d8016710460f2bdf (diff)
downloadgo-tangerine-5e29f4be935ff227bbf07a0c6e80e8809f5e0202.tar
go-tangerine-5e29f4be935ff227bbf07a0c6e80e8809f5e0202.tar.gz
go-tangerine-5e29f4be935ff227bbf07a0c6e80e8809f5e0202.tar.bz2
go-tangerine-5e29f4be935ff227bbf07a0c6e80e8809f5e0202.tar.lz
go-tangerine-5e29f4be935ff227bbf07a0c6e80e8809f5e0202.tar.xz
go-tangerine-5e29f4be935ff227bbf07a0c6e80e8809f5e0202.tar.zst
go-tangerine-5e29f4be935ff227bbf07a0c6e80e8809f5e0202.zip
cmd/utils, node: remove unused solc references and improve RPC config (#14324)
Currently http cors and websocket origins are a comma separated string in the config object. These are replaced with string arrays that are more expressive in case of a config file.
Diffstat (limited to 'node/api.go')
-rw-r--r--node/api.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/node/api.go b/node/api.go
index 3c451fc8a..570cb9d98 100644
--- a/node/api.go
+++ b/node/api.go
@@ -92,8 +92,13 @@ func (api *PrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis
if port == nil {
port = &api.node.config.HTTPPort
}
- if cors == nil {
- cors = &api.node.config.HTTPCors
+
+ allowedOrigins := api.node.config.HTTPCors
+ if cors != nil {
+ allowedOrigins = nil
+ for _, origin := range strings.Split(*cors, ",") {
+ allowedOrigins = append(allowedOrigins, strings.TrimSpace(origin))
+ }
}
modules := api.node.httpWhitelist
@@ -104,7 +109,7 @@ func (api *PrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis
}
}
- if err := api.node.startHTTP(fmt.Sprintf("%s:%d", *host, *port), api.node.rpcAPIs, modules, *cors); err != nil {
+ if err := api.node.startHTTP(fmt.Sprintf("%s:%d", *host, *port), api.node.rpcAPIs, modules, allowedOrigins); err != nil {
return false, err
}
return true, nil
@@ -141,8 +146,13 @@ func (api *PrivateAdminAPI) StartWS(host *string, port *int, allowedOrigins *str
if port == nil {
port = &api.node.config.WSPort
}
- if allowedOrigins == nil {
- allowedOrigins = &api.node.config.WSOrigins
+
+ origins := api.node.config.WSOrigins
+ if allowedOrigins != nil {
+ origins = nil
+ for _, origin := range strings.Split(*allowedOrigins, ",") {
+ origins = append(origins, strings.TrimSpace(origin))
+ }
}
modules := api.node.config.WSModules
@@ -153,7 +163,7 @@ func (api *PrivateAdminAPI) StartWS(host *string, port *int, allowedOrigins *str
}
}
- if err := api.node.startWS(fmt.Sprintf("%s:%d", *host, *port), api.node.rpcAPIs, modules, *allowedOrigins); err != nil {
+ if err := api.node.startWS(fmt.Sprintf("%s:%d", *host, *port), api.node.rpcAPIs, modules, origins); err != nil {
return false, err
}
return true, nil