[API节点]支持HTTP API

This commit is contained in:
刘祥超
2021-01-01 20:49:19 +08:00
parent 9b666ca31e
commit 6b86ce1aef
11 changed files with 286 additions and 36 deletions

View File

@@ -1,8 +1,27 @@
Tea.context(function () {
this.hasHTTPS = false
this.grpcAddrs = []
this.restAddrs = []
this.changeListens = function (addrs) {
this.hasHTTPS = addrs.$any(function (k, v) {
this.grpcAddrs = addrs
this.hasHTTPS = this.grpcAddrs.$any(function (k, v) {
return v.protocol == "https"
})
}) || (this.restIsOn && this.restAddrs.$any(function (k, v) {
return v.protocol == "https"
}))
}
this.changeRestListens = function (addrs) {
this.restAddrs = addrs
this.hasHTTPS = this.grpcAddrs.$any(function (k, v) {
return v.protocol == "https"
}) || (this.node.restIsOn && this.restAddrs.$any(function (k, v) {
return v.protocol == "https"
}))
}
this.restIsOn = false
})