solution: configuration for Websocket proxy
This commit is contained in:
@@ -58,6 +58,9 @@ class ProxyConfigReader : YamlConfigReader(), ConfigReader<ProxyConfig> {
|
|||||||
getValueAsBool(input, "enabled")?.let {
|
getValueAsBool(input, "enabled")?.let {
|
||||||
config.enabled = it
|
config.enabled = it
|
||||||
}
|
}
|
||||||
|
getValueAsBool(input, "websocket")?.let {
|
||||||
|
config.websocketEnabled = it
|
||||||
|
}
|
||||||
val currentRoutes = HashSet<String>()
|
val currentRoutes = HashSet<String>()
|
||||||
getList<MappingNode>(input, "routes")?.let { routes ->
|
getList<MappingNode>(input, "routes")?.let { routes ->
|
||||||
config.routes = routes.value.map { route ->
|
config.routes = routes.value.map { route ->
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class ProxyConfigReaderSpec extends Specification {
|
|||||||
|
|
||||||
then:
|
then:
|
||||||
act.enabled
|
act.enabled
|
||||||
|
act.websocketEnabled
|
||||||
act.port == 8080
|
act.port == 8080
|
||||||
act.host == '127.0.0.1'
|
act.host == '127.0.0.1'
|
||||||
act.routes.size() == 1
|
act.routes.size() == 1
|
||||||
@@ -39,6 +40,17 @@ class ProxyConfigReaderSpec extends Specification {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def "Read proxy config with websocket disabled"() {
|
||||||
|
setup:
|
||||||
|
def config = this.class.getClassLoader().getResourceAsStream("dshackle-proxy-no-ws.yaml")
|
||||||
|
when:
|
||||||
|
def act = reader.read(config)
|
||||||
|
|
||||||
|
then:
|
||||||
|
act.enabled
|
||||||
|
!act.websocketEnabled
|
||||||
|
}
|
||||||
|
|
||||||
def "Read proxy config with two elements"() {
|
def "Read proxy config with two elements"() {
|
||||||
setup:
|
setup:
|
||||||
def config = this.class.getClassLoader().getResourceAsStream("dshackle-proxy-two.yaml")
|
def config = this.class.getClassLoader().getResourceAsStream("dshackle-proxy-two.yaml")
|
||||||
|
|||||||
6
src/test/resources/dshackle-proxy-no-ws.yaml
Normal file
6
src/test/resources/dshackle-proxy-no-ws.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
proxy:
|
||||||
|
port: 8080
|
||||||
|
websocket: false
|
||||||
|
routes:
|
||||||
|
- id: ethereum
|
||||||
|
blockchain: ethereum
|
||||||
Reference in New Issue
Block a user