Commit 27ee94d5 authored by AfirSraftGarrier's avatar AfirSraftGarrier

回退一些

parent ecbca27e
...@@ -12,10 +12,9 @@ import io.netty.channel.socket.nio.NioServerSocketChannel; ...@@ -12,10 +12,9 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.ssl.ClientAuth; import io.netty.handler.ssl.ClientAuth;
import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder; import io.netty.handler.ssl.SslContextBuilder;
import iot.sixiang.license.util.CommonUtil;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import java.io.File; import java.io.File;
...@@ -29,17 +28,12 @@ public class TcpServer { ...@@ -29,17 +28,12 @@ public class TcpServer {
this.channelInitializer = channelInitializer; this.channelInitializer = channelInitializer;
} }
@SneakyThrows
private File getSECFile(String name) {
Resource resource = new ClassPathResource("sec/" + name);
return resource.getFile();
}
@SneakyThrows @SneakyThrows
public void start() { public void start() {
String topPath = CommonUtil.getServerParentDirectory() + File.separator + "/sec/";
SslContext sslContext = SslContextBuilder SslContext sslContext = SslContextBuilder
.forServer(getSECFile("server.crt"), getSECFile("server.pkcs8.key")) .forServer(new File(topPath + "server.crt"), new File(topPath + "server.pkcs8.key"))
.trustManager(getSECFile("ca.crt")) .trustManager(new File(topPath + "ca.crt"))
.clientAuth(ClientAuth.REQUIRE) .clientAuth(ClientAuth.REQUIRE)
.build(); .build();
......
...@@ -6,6 +6,7 @@ import iot.sixiang.license.util.CommonUtil; ...@@ -6,6 +6,7 @@ import iot.sixiang.license.util.CommonUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.io.File;
/** /**
* Title: LibHelper * Title: LibHelper
...@@ -21,7 +22,7 @@ public class LibHelper { ...@@ -21,7 +22,7 @@ public class LibHelper {
@PostConstruct @PostConstruct
public void init() { public void init() {
LibPathUtil.libDir = CommonUtil.getServerParentDirectory(); LibPathUtil.libDir = CommonUtil.getServerParentDirectory() + File.separator + "/libs";
safety = new Safety(); safety = new Safety();
} }
......
...@@ -264,7 +264,7 @@ public class CommonUtil { ...@@ -264,7 +264,7 @@ public class CommonUtil {
} }
public static String getServerParentDirectory() { public static String getServerParentDirectory() {
return new File(new ApplicationHome(Constant.class).getSource().getParentFile().getPath()).getParent() + File.separator + "lib"; return new File(new ApplicationHome(Constant.class).getSource().getParentFile().getPath()) + File.separator + "file";
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment