2

环境

经销商编号:Ubuntu

说明:Ubuntu 16.04.5 LTS

发布时间:16.04

代号:xenial

漏洞

我正在使用 dockerized apiman 版本 1.3.1.Final。(我知道很老...)

我正在尝试覆盖apiman-default-config.json文件的网关属性:

"Gateways" : [ {
"id" : "TheGateway",
"name" : "The Gateway",
"description" : "This is the gateway.",
"createdBy" : "admin",
"createdOn" : "2016-05-16T12:34:15Z",
"modifiedBy" : "admin",
"modifiedOn" : "2016-05-16T12:34:15Z",
"type" : "REST",
"configuration" : "{\"endpoint\":\"${apiman.gateway-endpoint:https://localhost:8443/apiman-gateway-api}\",\"username\":\"${apiman.gateway-endpoint.username:apimanager}\",\"password\":\"${apiman.gateway-endpoint.password:apiman123!}\"}" } ]

所以我的想法是我可以从 apiman.properties配置文件中覆盖这些属性。但是,例如,似乎没有评估属性${apiman.gateway-endpoint.username}并且在任何情况下都使用默认值 'apimanager'。

所以现在,我的问题是应该如何覆盖以下属性?:

apiman.gateway-endpoint
apiman.gateway-endpoint.username
apiman.gateway-endpoint.password

如果它是一个错误,它会在以后的 Apiman 版本中修复吗?

我可以覆盖整个文件,但如果我能避免这种情况,那就太好了......

问候

4

1 回答 1

1

在深入研究 Apiman 代码后,我发现这些变量已被 System.env 属性替换。为了覆盖它们,可以在 'extensions' 标记之后将这些行添加到您用于运行 apiman 的standalone-apiman.xml 配置中:

<system-properties>
       <property name="apiman.gateway-endpoint" value="http://apiman.gateway.com"/>
       <property name="apiman.gateway-endpoint.username" value="username"/>
       <property name="apiman.gateway-endpoint.password" value="password"/>
</system-properties>
于 2018-11-27T16:07:31.267 回答