Browse Source

fix jsk cer bug

wwd 3 years ago
parent
commit
9034fda102

+ 3 - 2
src/main/java/com/persagy/ztkencryptdecodedata/kafka/CloudKafkaConsumerFromEdgeTopic.java

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
+import org.springframework.util.ResourceUtils;
 
 import javax.annotation.PostConstruct;
 import java.util.Collection;
@@ -98,10 +99,10 @@ public class CloudKafkaConsumerFromEdgeTopic implements CommandLineRunner {
         props.put("ssl.endpoint.identification.algorithm",algorithm);
         // properties.put("ssl.truststore.location", ResourceUtils.getFile(truststorelocaltion).getPath());
         // properties.put("ssl.truststore.password", keystorepassword);
-        props.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG,keystorelocaltion);
+        props.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, ResourceUtils.getFile(keystorelocaltion).getPath());
         props.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG,keystorepassword);
         props.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG,keypassword);
-        props.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,truststorelocaltion);
+        props.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, ResourceUtils.getFile(truststorelocaltion).getPath());
         props.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG,truststorepassword);
 
 

+ 2 - 2
src/main/java/com/persagy/ztkencryptdecodedata/kafka/EdgeKafkaProducer.java

@@ -93,10 +93,10 @@ public class EdgeKafkaProducer  {
         properties.put("ssl.endpoint.identification.algorithm",algorithm);
        // properties.put("ssl.truststore.location", ResourceUtils.getFile(truststorelocaltion).getPath());
        // properties.put("ssl.truststore.password", keystorepassword);
-        properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG,keytorelocaltion);
+        properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, ResourceUtils.getFile(keytorelocaltion).getPath());
         properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG,keystorepassword);
         properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG,keypassword);
-        properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,truststorelocaltion);
+        properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,ResourceUtils.getFile(truststorelocaltion).getPath());
         properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG,truststorepassword);
 
 

File diff suppressed because it is too large
+ 28 - 1
src/main/resources/application-prod.yml


+ 4 - 4
src/main/resources/application-uat.yml

@@ -28,10 +28,10 @@ spring:
         endpoint:
           identification:
             algorithm: ""
-        trust-store-location: uatclient.truststore.jks
+        trust-store-location: "classpath:uatclient.truststore.jks"
         trust-store-password: test1234
         key-password: test1234
-        key-store-location: uatclient.keystore.jks
+        key-store-location: "classpath:uatclient.keystore.jks"
         key-store-password: test1234
 
 
@@ -51,10 +51,10 @@ spring:
         endpoint:
           identification:
             algorithm: ""
-        trust-store-location: uatclient.truststore.jks
+        trust-store-location: "classpath:uatclient.truststore.jks"
         trust-store-password: test1234
         key-password: test1234
-        key-store-location: uatclient.keystore.jks
+        key-store-location: "classpath:uatclient.keystore.jks"
         key-store-password: test1234
 
 

+ 1 - 1
src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: dev
+    active: uat
   location: Edge  # Edge 边缘测 or Cloud 云端