mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 12:20:28 +08:00
[API节点]支持HTTP API
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"time"
|
||||
@@ -52,11 +53,44 @@ func (this *IndexAction) RunGet(params struct{}) {
|
||||
status.IsActive = status.IsActive && time.Now().Unix()-status.UpdatedAt <= 60 // N秒之内认为活跃
|
||||
}
|
||||
|
||||
// Rest地址
|
||||
restAccessAddrs := []string{}
|
||||
if node.RestIsOn {
|
||||
if len(node.RestHTTPJSON) > 0 {
|
||||
httpConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||
err = json.Unmarshal(node.RestHTTPJSON, httpConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
_ = httpConfig.Init()
|
||||
if httpConfig.IsOn && len(httpConfig.Listen) > 0 {
|
||||
for _, listen := range httpConfig.Listen {
|
||||
restAccessAddrs = append(restAccessAddrs, listen.FullAddresses()...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(node.RestHTTPSJSON) > 0 {
|
||||
httpsConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||
err = json.Unmarshal(node.RestHTTPSJSON, httpsConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
_ = httpsConfig.Init()
|
||||
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 {
|
||||
restAccessAddrs = append(restAccessAddrs, httpsConfig.FullAddresses()...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nodeMaps = append(nodeMaps, maps.Map{
|
||||
"id": node.Id,
|
||||
"isOn": node.IsOn,
|
||||
"name": node.Name,
|
||||
"accessAddrs": node.AccessAddrs,
|
||||
"id": node.Id,
|
||||
"isOn": node.IsOn,
|
||||
"name": node.Name,
|
||||
"accessAddrs": node.AccessAddrs,
|
||||
"restAccessAddrs": restAccessAddrs,
|
||||
"status": maps.Map{
|
||||
"isActive": status.IsActive,
|
||||
"updatedAt": status.UpdatedAt,
|
||||
|
||||
@@ -28,7 +28,11 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
ListensJSON []byte
|
||||
CertIdsJSON []byte
|
||||
AccessAddrsJSON []byte
|
||||
IsOn bool
|
||||
|
||||
RestIsOn bool
|
||||
RestListensJSON []byte
|
||||
|
||||
IsOn bool
|
||||
|
||||
Must *actions.Must
|
||||
}) {
|
||||
@@ -59,6 +63,27 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
// Rest监听地址
|
||||
restHTTPConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||
restHTTPSConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||
if params.RestIsOn {
|
||||
restListens := []*serverconfigs.NetworkAddressConfig{}
|
||||
err = json.Unmarshal(params.RestListensJSON, &restListens)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
for _, addr := range restListens {
|
||||
if addr.Protocol.IsHTTPFamily() {
|
||||
restHTTPConfig.IsOn = true
|
||||
restHTTPConfig.Listen = append(restHTTPConfig.Listen, addr)
|
||||
} else if addr.Protocol.IsHTTPSFamily() {
|
||||
restHTTPSConfig.IsOn = true
|
||||
restHTTPSConfig.Listen = append(restHTTPSConfig.Listen, addr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 证书
|
||||
certIds := []int64{}
|
||||
if len(params.CertIdsJSON) > 0 {
|
||||
@@ -68,7 +93,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
}
|
||||
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 && len(certIds) == 0 {
|
||||
if ((httpsConfig.IsOn && len(httpsConfig.Listen) > 0) || (restHTTPSConfig.IsOn && len(httpsConfig.Listen) > 0)) && len(certIds) == 0 {
|
||||
this.Fail("请添加至少一个证书")
|
||||
}
|
||||
|
||||
@@ -99,6 +124,10 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
IsOn: true,
|
||||
SSLPolicyId: sslPolicyId,
|
||||
}
|
||||
restHTTPSConfig.SSLPolicyRef = &sslconfigs.SSLPolicyRef{
|
||||
IsOn: true,
|
||||
SSLPolicyId: sslPolicyId,
|
||||
}
|
||||
}
|
||||
|
||||
// 访问地址
|
||||
@@ -123,11 +152,25 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
restHTTPJSON, err := json.Marshal(restHTTPConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
restHTTPSJSON, err := json.Marshal(restHTTPSConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
createResp, err := this.RPC().APINodeRPC().CreateAPINode(this.AdminContext(), &pb.CreateAPINodeRequest{
|
||||
Name: params.Name,
|
||||
Description: params.Description,
|
||||
HttpJSON: httpJSON,
|
||||
HttpsJSON: httpsJSON,
|
||||
RestIsOn: params.RestIsOn,
|
||||
RestHTTPJSON: restHTTPJSON,
|
||||
RestHTTPSJSON: restHTTPSJSON,
|
||||
AccessAddrsJSON: params.AccessAddrsJSON,
|
||||
IsOn: params.IsOn,
|
||||
})
|
||||
|
||||
@@ -87,15 +87,45 @@ func (this *IndexAction) RunGet(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
// Rest地址
|
||||
restAccessAddrs := []*serverconfigs.NetworkAddressConfig{}
|
||||
if node.RestIsOn {
|
||||
if len(node.RestHTTPJSON) > 0 {
|
||||
httpConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||
err = json.Unmarshal(node.RestHTTPJSON, httpConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if httpConfig.IsOn && len(httpConfig.Listen) > 0 {
|
||||
restAccessAddrs = append(restAccessAddrs, httpConfig.Listen...)
|
||||
}
|
||||
}
|
||||
|
||||
if len(node.RestHTTPSJSON) > 0 {
|
||||
httpsConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||
err = json.Unmarshal(node.RestHTTPSJSON, httpsConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 {
|
||||
restAccessAddrs = append(restAccessAddrs, httpsConfig.Listen...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.Data["node"] = maps.Map{
|
||||
"id": node.Id,
|
||||
"name": node.Name,
|
||||
"description": node.Description,
|
||||
"isOn": node.IsOn,
|
||||
"listens": listens,
|
||||
"accessAddrs": accessAddrs,
|
||||
"hasHTTPS": sslPolicyId > 0,
|
||||
"certs": certs,
|
||||
"id": node.Id,
|
||||
"name": node.Name,
|
||||
"description": node.Description,
|
||||
"isOn": node.IsOn,
|
||||
"listens": listens,
|
||||
"accessAddrs": accessAddrs,
|
||||
"restIsOn": node.RestIsOn,
|
||||
"restAccessAddrs": restAccessAddrs,
|
||||
"hasHTTPS": sslPolicyId > 0,
|
||||
"certs": certs,
|
||||
}
|
||||
|
||||
this.Show()
|
||||
|
||||
@@ -11,7 +11,7 @@ func init() {
|
||||
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
||||
server.
|
||||
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeSetting)).
|
||||
Helper(settingutils.NewHelper("apiNodes")).
|
||||
Helper(settingutils.NewAdvancedHelper("apiNodes")).
|
||||
Prefix("/api/node").
|
||||
|
||||
// 这里不受Helper的约束
|
||||
|
||||
@@ -57,6 +57,28 @@ func (this *UpdateAction) RunGet(params struct {
|
||||
listens = append(listens, httpConfig.Listen...)
|
||||
listens = append(listens, httpsConfig.Listen...)
|
||||
|
||||
restHTTPConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||
if len(node.RestHTTPJSON) > 0 {
|
||||
err = json.Unmarshal(node.RestHTTPJSON, restHTTPConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
restHTTPSConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||
if len(node.RestHTTPSJSON) > 0 {
|
||||
err = json.Unmarshal(node.RestHTTPSJSON, restHTTPSConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 监听地址
|
||||
restListens := []*serverconfigs.NetworkAddressConfig{}
|
||||
restListens = append(restListens, restHTTPConfig.Listen...)
|
||||
restListens = append(restListens, restHTTPSConfig.Listen...)
|
||||
|
||||
// 证书信息
|
||||
certs := []*sslconfigs.SSLCertConfig{}
|
||||
sslPolicyId := int64(0)
|
||||
@@ -95,6 +117,8 @@ func (this *UpdateAction) RunGet(params struct {
|
||||
"description": node.Description,
|
||||
"isOn": node.IsOn,
|
||||
"listens": listens,
|
||||
"restIsOn": node.RestIsOn,
|
||||
"restListens": restListens,
|
||||
"certs": certs,
|
||||
"sslPolicyId": sslPolicyId,
|
||||
"accessAddrs": accessAddrs,
|
||||
@@ -109,6 +133,8 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
Name string
|
||||
SslPolicyId int64
|
||||
ListensJSON []byte
|
||||
RestIsOn bool
|
||||
RestListensJSON []byte
|
||||
CertIdsJSON []byte
|
||||
AccessAddrsJSON []byte
|
||||
Description string
|
||||
@@ -143,6 +169,27 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
// Rest监听地址
|
||||
restHTTPConfig := &serverconfigs.HTTPProtocolConfig{}
|
||||
restHTTPSConfig := &serverconfigs.HTTPSProtocolConfig{}
|
||||
if params.RestIsOn {
|
||||
restListens := []*serverconfigs.NetworkAddressConfig{}
|
||||
err = json.Unmarshal(params.RestListensJSON, &restListens)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
for _, addr := range restListens {
|
||||
if addr.Protocol.IsHTTPFamily() {
|
||||
restHTTPConfig.IsOn = true
|
||||
restHTTPConfig.Listen = append(restHTTPConfig.Listen, addr)
|
||||
} else if addr.Protocol.IsHTTPSFamily() {
|
||||
restHTTPSConfig.IsOn = true
|
||||
restHTTPSConfig.Listen = append(restHTTPSConfig.Listen, addr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 证书
|
||||
certIds := []int64{}
|
||||
if len(params.CertIdsJSON) > 0 {
|
||||
@@ -152,7 +199,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
return
|
||||
}
|
||||
}
|
||||
if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 && len(certIds) == 0 {
|
||||
if ((httpsConfig.IsOn && len(httpsConfig.Listen) > 0) || (restHTTPSConfig.IsOn && len(httpsConfig.Listen) > 0)) && len(certIds) == 0 {
|
||||
this.Fail("请添加至少一个证书")
|
||||
}
|
||||
|
||||
@@ -196,6 +243,10 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
IsOn: true,
|
||||
SSLPolicyId: sslPolicyId,
|
||||
}
|
||||
restHTTPSConfig.SSLPolicyRef = &sslconfigs.SSLPolicyRef{
|
||||
IsOn: true,
|
||||
SSLPolicyId: sslPolicyId,
|
||||
}
|
||||
|
||||
// 访问地址
|
||||
accessAddrs := []*serverconfigs.NetworkAddressConfig{}
|
||||
@@ -218,6 +269,16 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
restHTTPJSON, err := json.Marshal(restHTTPConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
restHTTPSJSON, err := json.Marshal(restHTTPSConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = this.RPC().APINodeRPC().UpdateAPINode(this.AdminContext(), &pb.UpdateAPINodeRequest{
|
||||
NodeId: params.NodeId,
|
||||
@@ -225,6 +286,9 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
Description: params.Description,
|
||||
HttpJSON: httpJSON,
|
||||
HttpsJSON: httpsJSON,
|
||||
RestIsOn: params.RestIsOn,
|
||||
RestHTTPJSON: restHTTPJSON,
|
||||
RestHTTPSJSON: restHTTPSJSON,
|
||||
AccessAddrsJSON: params.AccessAddrsJSON,
|
||||
IsOn: params.IsOn,
|
||||
})
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>节点名称</th>
|
||||
<th>访问地址</th>
|
||||
<th>GRPC访问地址</th>
|
||||
<th>HTTP访问地址</th>
|
||||
<th class="width6 center">版本号</th>
|
||||
<th class="width5 center">CPU</th>
|
||||
<th class="width5 center">内存</th>
|
||||
@@ -22,9 +23,16 @@
|
||||
<td>{{node.name}}</td>
|
||||
<td>
|
||||
<div v-if="node.accessAddrs != null && node.accessAddrs.length > 0">
|
||||
<span class="ui label tiny basic" v-for="addr in node.accessAddrs">{{addr}}</span>
|
||||
<span class="ui label tiny basic" v-for="addr in node.accessAddrs" style="margin-bottom: 0.5em">{{addr}}</span>
|
||||
</div>
|
||||
<div v-else class="disabled">-</div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="node.restAccessAddrs != null && node.restAccessAddrs.length > 0">
|
||||
<span class="ui label tiny basic" v-for="addr in node.restAccessAddrs" style="margin-bottom: 0.5em">{{addr}}</span>
|
||||
</div>
|
||||
<div v-else class="disabled">-</div>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span v-if="node.status.buildVersion.length > 0">v{{node.status.buildVersion}}</span>
|
||||
<span v-else class="disabled">-</span>
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>进程监听端口 *</td>
|
||||
<td>GRPC监听端口 *</td>
|
||||
<td>
|
||||
<network-addresses-box :v-name="'listensJSON'" :v-server-type="'httpWeb'" @change="changeListens"></network-addresses-box>
|
||||
<p class="comment">API节点进程监听的网络端口。</p>
|
||||
<p class="comment">通过GRPC访问API节点进程监听的网络端口。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="hasHTTPS">
|
||||
@@ -23,17 +23,30 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>外部访问地址 *</td>
|
||||
<td>GRPC 外部访问地址 *</td>
|
||||
<td>
|
||||
<api-node-addresses-box :v-name="'accessAddrsJSON'"></api-node-addresses-box>
|
||||
<p class="comment">边缘节点和管理平台等外部节点访问API节点的网络地址。</p>
|
||||
<p class="comment">边缘节点和管理平台等外部节点访问API节点的网络地址,需要保证其他节点能够通过此地址访问到API节点服务。</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td :class="{'color-border': restIsOn}">是否开启HTTP API端口</td>
|
||||
<td>
|
||||
<checkbox name="restIsOn" v-model="restIsOn">是否启用HTTP API</checkbox>
|
||||
<p class="comment">启用后用户可以通过HTTP API调用服务接口。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="restIsOn">
|
||||
<td class="color-border">HTTP API监听端口</td>
|
||||
<td>
|
||||
<network-addresses-box :v-name="'restListensJSON'" :v-server-type="'httpWeb'" @change="changeRestListens"></network-addresses-box>
|
||||
<p class="comment">HTTP API节点进程监听的网络端口。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
|
||||
@@ -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
|
||||
})
|
||||
@@ -15,7 +15,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>进程监听端口</td>
|
||||
<td>GRPC监听端口</td>
|
||||
<td>
|
||||
<network-addresses-view :v-addresses="node.listens"></network-addresses-view>
|
||||
<p class="comment">API节点进程监听的网络端口。</p>
|
||||
@@ -28,12 +28,19 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>外部访问地址</td>
|
||||
<td>GRPC外部访问地址</td>
|
||||
<td>
|
||||
<network-addresses-view :v-addresses="node.accessAddrs"></network-addresses-view>
|
||||
<p class="comment">外部访问API节点的网络地址。</p>
|
||||
<p class="comment">通过GRPC访问API节点的网络地址。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="node.restIsOn">
|
||||
<td>HTTP外部访问地址</td>
|
||||
<td>
|
||||
<network-addresses-view :v-addresses="node.restAccessAddrs"></network-addresses-view>
|
||||
<p class="comment">通过HTTP访问API节点的网络地址。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>进程监听端口 *</td>
|
||||
<td>GRPC监听端口 *</td>
|
||||
<td>
|
||||
<network-addresses-box :v-name="'listensJSON'" :v-server-type="'httpWeb'" :v-addresses="node.listens" @change="changeListens"></network-addresses-box>
|
||||
<p class="comment">API节点进程监听的网络端口。</p>
|
||||
<p class="comment">通过GRPC访问API节点进程监听的网络端口。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="hasHTTPS">
|
||||
@@ -26,17 +26,30 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>外部访问地址 *</td>
|
||||
<td>GRPC访问地址 *</td>
|
||||
<td>
|
||||
<api-node-addresses-box :v-name="'accessAddrsJSON'" :v-addrs="node.accessAddrs"></api-node-addresses-box>
|
||||
<p class="comment">边缘节点和管理平台等外部节点访问API节点的网络地址。</p>
|
||||
<p class="comment">边缘节点和管理平台等外部节点访问API节点的网络地址,需要保证其他节点能够通过此地址访问到API节点服务。</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td :class="{'color-border': node.restIsOn}">是否开启HTTP API端口</td>
|
||||
<td>
|
||||
<checkbox name="restIsOn" v-model="node.restIsOn">是否启用HTTP API</checkbox>
|
||||
<p class="comment">启用后用户可以通过HTTP API调用服务接口。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="node.restIsOn">
|
||||
<td class="color-border">HTTP API监听端口</td>
|
||||
<td>
|
||||
<network-addresses-box :v-name="'restListensJSON'" :v-server-type="'httpWeb'" @change="changeRestListens" :v-addresses="node.restListens"></network-addresses-box>
|
||||
<p class="comment">HTTP API节点进程监听的网络端口。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
|
||||
@@ -3,10 +3,29 @@ Tea.context(function () {
|
||||
|
||||
this.hasHTTPS = this.node.listens.$any(function (k, v) {
|
||||
return v.protocol == "https"
|
||||
})
|
||||
}) || (this.node.restIsOn && this.node.restListens.$any(function (k, v) {
|
||||
return v.protocol == "https"
|
||||
}))
|
||||
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.node.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"
|
||||
}))
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user