@@ -50,15 +50,15 @@ public static void confReplace(String path) {
5050 StringBuffer buf = new StringBuffer ();
5151 // 保存该行前面的内容
5252 while ((temp = br .readLine ()) != null ) {
53- if (temp .contains ("${HOSTNAME_AGENT_ID}" )){
54- temp = temp .replace ("${HOSTNAME_AGENT_ID}" , AgentRegisterReport .getInternalHostName ()+ "-" + AgentRegisterReport .getAgentFlag ().toString ());
55- }else if (temp .contains ("${HOSTNAME}" )){
56- temp = temp .replace ("${HOSTNAME}" ,AgentRegisterReport .getInternalHostName ());
57- }else if (temp .contains ("${AGENT_ID}" )){
58- temp = temp .replace ("${AGENT_ID}" ,AgentRegisterReport .getAgentFlag ().toString ());
59- }else if (temp .contains ("${OPENAPI}" )){
53+ if (temp .contains ("${HOSTNAME_AGENT_ID}" )) {
54+ temp = temp .replace ("${HOSTNAME_AGENT_ID}" , AgentRegisterReport .getInternalHostName () + "-" + AgentRegisterReport .getAgentFlag ().toString ());
55+ } else if (temp .contains ("${HOSTNAME}" )) {
56+ temp = temp .replace ("${HOSTNAME}" , AgentRegisterReport .getInternalHostName ());
57+ } else if (temp .contains ("${AGENT_ID}" )) {
58+ temp = temp .replace ("${AGENT_ID}" , AgentRegisterReport .getAgentFlag ().toString ());
59+ } else if (temp .contains ("${OPENAPI}" )) {
6060 String logAddress = IastProperties .getInstance ().getLogAddress ();
61- if (null == logAddress ){
61+ if (null == logAddress ) {
6262 String s = IastProperties .getInstance ().getBaseUrl ();
6363 try {
6464 String openApiDomain = new URI (s ).getHost ();
@@ -70,17 +70,16 @@ public static void confReplace(String path) {
7070 }
7171 temp = temp .replace ("${OPENAPI}" , s );
7272 }
73- }else {
73+ } else {
7474 temp = temp .replace ("${OPENAPI}" , logAddress );
7575 }
76- }else if (temp .contains ("${LOG_PORT}" )){
76+ } else if (temp .contains ("${LOG_PORT}" )) {
7777 String logPort = IastProperties .getInstance ().getLogPort ();
78- if (null == logPort ){
78+ if (null == logPort ) {
7979 String s = IastProperties .getInstance ().getBaseUrl ();
8080 try {
8181 int openApiPort = new URI (s ).getPort ();
82- temp = temp .replace ("${LOG_PORT}" , openApiPort > 0 ? Integer .toString (openApiPort ) :
83- ("https" .equalsIgnoreCase (new URI (s ).getScheme ()) ? "443" : "80" ));
82+ temp = temp .replace ("${LOG_PORT}" , openApiPort > 0 ? Integer .toString (openApiPort ) : "80" );
8483 } catch (Exception e ) {
8584 s = s .substring (s .indexOf ("://" ) + 3 , s .indexOf ("/openapi" ));
8685 if (s .contains (":" )) {
@@ -90,11 +89,11 @@ public static void confReplace(String path) {
9089 temp = temp .replace ("${LOG_PORT}" , "80" );
9190 }
9291 }
93- }else {
92+ } else {
9493 temp = temp .replace ("${LOG_PORT}" , logPort );
9594 }
96- }else if (temp .contains ("${LOG_PATH}" )){
97- temp = temp .replace ("${LOG_PATH}" , System .getProperty ("java.io.tmpdir.dongtai" )+ File .separator + "dongtaiJavaAgentLogs" + File .separator + "dongtai_javaagent.log" );
95+ } else if (temp .contains ("${LOG_PATH}" )) {
96+ temp = temp .replace ("${LOG_PATH}" , System .getProperty ("java.io.tmpdir.dongtai" ) + File .separator + "dongtaiJavaAgentLogs" + File .separator + "dongtai_javaagent.log" );
9897 }
9998 buf = buf .append (temp );
10099 buf = buf .append (System .getProperty ("line.separator" ));
0 commit comments