Browse Source

修改Es读取外部配置文件host port

15810770710@163.com 3 years ago
parent
commit
1b79b624d6

+ 2 - 4
src/main/java/com/jkcredit/query/record/config/EsConfig.java

@@ -27,10 +27,6 @@ import java.util.Properties;
 @Configuration
 @Slf4j
 public class EsConfig {
-    @Value("${ElasticSearch.host}")
-    private String host;
-    @Value("${ElasticSearch.port}")
-    private Integer port;
     @Value("${ElasticSearch.userFilePath}")
     private String userFilePath;
 
@@ -46,6 +42,8 @@ public class EsConfig {
         }
         String username = properties.getProperty("username");
         String password = properties.getProperty("password");
+        String host = properties.getProperty("host");
+        int port = Integer.parseInt(properties.getProperty("port"));
 
         RestClientBuilder builder = null;
         // 可以指定多个es

+ 0 - 2
src/main/resources/application-dev.yml

@@ -9,6 +9,4 @@ recordsEncrypt:
   ivStr: dbdca8e8316fdee2
   algorithm: SM4_CBC
 ElasticSearch:
-  host: es-cn-2r427cps10022b0yt.elasticsearch.aliyuncs.com
-  port: 9200
   userFilePath: /Users/jkxy/Desktop/test/key/key.properties

+ 0 - 2
src/main/resources/application-prod.yml

@@ -9,7 +9,5 @@ recordsEncrypt:
   ivStr: dbdca8e8316fdee2
   algorithm: SM4_CBC
 ElasticSearch:
-  host: es-cn-2r427cps10022b0yt.elasticsearch.aliyuncs.com
-  port: 9200
   userFilePath: /home/jkxy-01/key.properties
 

+ 1 - 1
src/main/resources/logback-spring.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration debug="false" scan="false">
     <springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
-    <property name="log.path" value="logs"/>
+    <property name="log.path" value="/home/jkxy-01/qy/logs"/>
     <!-- 彩色日志格式 -->
     <property name="CONSOLE_LOG_PATTERN"
               value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>