Commit 27ee94d5 authored by AfirSraftGarrier's avatar AfirSraftGarrier

回退一些

parent ecbca27e
......@@ -12,10 +12,9 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.ssl.ClientAuth;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import iot.sixiang.license.util.CommonUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import java.io.File;
......@@ -29,17 +28,12 @@ public class TcpServer {
this.channelInitializer = channelInitializer;
}
@SneakyThrows
private File getSECFile(String name) {
Resource resource = new ClassPathResource("sec/" + name);
return resource.getFile();
}
@SneakyThrows
public void start() {
String topPath = CommonUtil.getServerParentDirectory() + File.separator + "/sec/";
SslContext sslContext = SslContextBuilder
.forServer(getSECFile("server.crt"), getSECFile("server.pkcs8.key"))
.trustManager(getSECFile("ca.crt"))
.forServer(new File(topPath + "server.crt"), new File(topPath + "server.pkcs8.key"))
.trustManager(new File(topPath + "ca.crt"))
.clientAuth(ClientAuth.REQUIRE)
.build();
......
......@@ -6,6 +6,7 @@ import iot.sixiang.license.util.CommonUtil;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.io.File;
/**
* Title: LibHelper
......@@ -21,7 +22,7 @@ public class LibHelper {
@PostConstruct
public void init() {
LibPathUtil.libDir = CommonUtil.getServerParentDirectory();
LibPathUtil.libDir = CommonUtil.getServerParentDirectory() + File.separator + "/libs";
safety = new Safety();
}
......
......@@ -264,7 +264,7 @@ public class CommonUtil {
}
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