eureka-js-client 模块在 AWS 上覆盖 "hostName" 而 运行

eureka-js-client module overwrites "hostName" while running on AWS

我正在使用 eureka-js-client 在 Eureka 上注册,这在本地部署时工作正常,但是当我在 AWS 上部署时,"hostName" 值集被替换为空值。

由于我将 ingressUrl 设置为主机名,如何阻止 eureka-js-client 不触摸 "hostName"?

eureka-js-client 版本 - “4.2.0” Eureka 版本 - 1.9.2, (SpringBoot 2.x)

这是 Eureka 配置的一部分:

"instance": {
    "app": "<MyApp>",
    "hostName": "<MyHostname>", // I dont want this to be overwritten by AWS-meta-data
    "ipAddr": "<MyIp>",
    "vipAddress": "<MyVip>",
    "secureVipAddress": "<address>",
    "homePageUrl": "<url>",
    "healthCheckUrl": "<url>",
    "statusPageUrl": "<url>",
    "instanceId": "<InstanceId>"
    "port": {
      "$": 80,
      "@enabled": false
    },
    "securePort": {
      "$": 443,
      "@enabled": true
    },
    "dataCenterInfo": {
      "@class": "com.netflix.appinfo.AmazonInfo",
      "name": "Amazon"
    },
  },
  "useLocalMetadata": true
}

这就是我最终要做的,

"instance": {
    "app": "<MyApp>",
    "hostName": "<MyHostname>", // I dont want this to be overwritten by AWS-meta-data
    "ipAddr": "<MyIp>",
    "vipAddress": "<MyVip>",
    "secureVipAddress": "<address>",
    "homePageUrl": "<url>",
    "healthCheckUrl": "<url>",
    "statusPageUrl": "<url>",
    "instanceId": "<InstanceId>"
    "port": {
      "$": 80,
      "@enabled": false
    },
    "securePort": {
      "$": 443,
      "@enabled": true
    },
    "dataCenterInfo": {
      "@class": "com.netflix.appinfo.AmazonInfo",
      "name": "Amazon"
    },
    "eureka": {
       "serviceUrls": {
          "default": "<eureka_url>"
        },
       "fetchMetadata" : false, #turn this off, and set your own metadata, you can use AWSmetada.js present in eurek-client-js
       "registerWithEureka" : true
    }
}

有关详细信息,请参阅此处:https://www.npmjs.com/package/eureka-js-client#configuring-for-aws-environments