diff --git a/fire-common/src/main/scala/com/zto/fire/common/conf/FireFrameworkConf.scala b/fire-common/src/main/scala/com/zto/fire/common/conf/FireFrameworkConf.scala index f3ab42ddc5e847b5ceb3b2ec66170cd79e8000e9..52380200b89821ae1df80faf1f1146cde7550dc1 100644 --- a/fire-common/src/main/scala/com/zto/fire/common/conf/FireFrameworkConf.scala +++ b/fire-common/src/main/scala/com/zto/fire/common/conf/FireFrameworkConf.scala @@ -107,6 +107,10 @@ private[fire] object FireFrameworkConf { lazy val FIRE_CONFIG_CENTER_REGISTER_CONF_PROD_ADDRESS = "fire.config_center.register.conf.prod.address" // 配置中心测试环境注册地址 lazy val FIRE_CONFIG_CENTER_REGISTER_CONF_TEST_ADDRESS = "fire.config_center.register.conf.test.address" + // 配置中心接口header key + lazy val FIRE_CONFIG_CENTER_REGISTER_CONF_ZDP_HEADER_KEY = "fire.config_center.register.conf.zdp.header.key" + // 配置中心接口header value + lazy val FIRE_CONFIG_CENTER_REGISTER_CONF_ZDP_HEADER_VALUE = "fire.config_center.register.conf.zdp.header.value" // 配置打印黑名单,配置项以逗号分隔 lazy val FIRE_CONF_PRINT_BLACKLIST = "fire.conf.print.blacklist" // 是否启用动态配置功能 @@ -281,6 +285,10 @@ private[fire] object FireFrameworkConf { lazy val configCenterProdAddress = PropUtils.getString(this.FIRE_CONFIG_CENTER_REGISTER_CONF_PROD_ADDRESS, "") // 配置中心测试环境注册地址 lazy val configCenterTestAddress = PropUtils.getString(this.FIRE_CONFIG_CENTER_REGISTER_CONF_TEST_ADDRESS) + // 配置中心接口header key + lazy val configCenterZdpHeaderKey = PropUtils.getString(this.FIRE_CONFIG_CENTER_REGISTER_CONF_ZDP_HEADER_KEY, "") + // 配置中心接口header value + lazy val configCenterZdpHeaderValue = PropUtils.getString(this.FIRE_CONFIG_CENTER_REGISTER_CONF_ZDP_HEADER_VALUE, "") // 任务的唯一标识 lazy val configCenterAppId = PropUtils.getString(this.FIRE_CONFIG_CENTER_APP_ID) diff --git a/fire-common/src/main/scala/com/zto/fire/common/util/ConfigurationCenterManager.scala b/fire-common/src/main/scala/com/zto/fire/common/util/ConfigurationCenterManager.scala index fb7613ec0e84eda7f52572f644395033def6f038..47ced12915d8d5c63c7919c1745de4445e577ca9 100644 --- a/fire-common/src/main/scala/com/zto/fire/common/util/ConfigurationCenterManager.scala +++ b/fire-common/src/main/scala/com/zto/fire/common/util/ConfigurationCenterManager.scala @@ -21,6 +21,7 @@ import com.zto.fire.common.bean.config.ConfigurationParam import com.zto.fire.common.conf.FireFrameworkConf import com.zto.fire.common.enu.ConfigureLevel import com.zto.fire.predef._ +import org.apache.commons.httpclient.Header import org.apache.commons.lang3.StringUtils /** @@ -43,7 +44,7 @@ private[fire] object ConfigurationCenterManager extends Serializable with Loggin val rest = FireFrameworkConf.fireRestUrl if (StringUtils.isBlank(rest)) logWarning("Fire Rest Server 地址为空,将无法完成注册") s""" - |{"className": "${className.replace("$", "")}", "url": "$rest", "fireVersion": "${FireFrameworkConf.fireVersion}", "zrcKey": "${FireFrameworkConf.configCenterSecret}", "engine": "${PropUtils.engine}", "appId": "${getFireAppId}"} + |{ "url": "$rest", "fireVersion": "${FireFrameworkConf.fireVersion}", "engine": "${PropUtils.engine}", "taskId": "${getFireAppId}"} """.stripMargin } @@ -75,7 +76,7 @@ private[fire] object ConfigurationCenterManager extends Serializable with Loggin */ private[this] def invoke(url: String, param: String): String = { try { - HttpClientUtils.doPost(url, param) + HttpClientUtils.doPost(url, param,new Header(FireFrameworkConf.configCenterZdpHeaderKey,FireFrameworkConf.configCenterZdpHeaderValue)) } catch { case _: Throwable => logError("调用配置中心接口失败,开始尝试调用测试环境配置中心接口。") ""