|
@@ -127,8 +127,14 @@ public class ConfUtil {
|
|
|
.append("endpoint=\"opc.tcp://").append(item.getStr("ip")).append(":").append(item.getStr("port")).append("\"\n")
|
|
|
.append("connect_timeout=\"10s\"\n")
|
|
|
.append("request_timeout=\"5s\"\n")
|
|
|
- .append("security_policy=\"").append(item.getStr("securityPolicy")).append("\"\n")
|
|
|
- .append("security_mode=\"").append(item.getStr("securityMode")).append("\"\n");
|
|
|
+ .append("security_policy=\"").append(item.getStr("securityPolicy","auto")).append("\"\n")
|
|
|
+ .append("security_mode=\"").append(item.getStr("securityMode","auto")).append("\"\n")
|
|
|
+ .append("certificate=\"").append(
|
|
|
+ replaceSlash(item.getStr("certificate",""))
|
|
|
+ ).append("\"\n")
|
|
|
+ .append("private_key=\"").append(
|
|
|
+ replaceSlash(item.getStr("private_key",""))
|
|
|
+ ).append("\"\n");
|
|
|
Integer identityProvider = item.getInt("identityProvider");
|
|
|
if (identityProvider == 0) {
|
|
|
builder.append("auth_method=\"Anonymous\"\n");
|
|
@@ -174,6 +180,16 @@ public class ConfUtil {
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
+ private static String replaceSlash(String value){
|
|
|
+ if(StrUtil.isEmpty(value)){
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ if(!value.contains("\\")){
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ value = value.replace("\\\\","\\").replace("\\","/");
|
|
|
+ return value;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
private static String createOpcUaFast(JSONObject item) {
|
|
@@ -184,8 +200,14 @@ public class ConfUtil {
|
|
|
.append("subscription_interval=\"").append(item.getStr("interval")).append("\"\n")
|
|
|
.append("connect_timeout=\"10s\"\n")
|
|
|
.append("request_timeout=\"5s\"\n")
|
|
|
- .append("security_policy=\"").append(item.getStr("securityPolicy")).append("\"\n")
|
|
|
- .append("security_mode=\"").append(item.getStr("securityMode")).append("\"\n");
|
|
|
+ .append("security_policy=\"").append(item.getStr("securityPolicy","auto")).append("\"\n")
|
|
|
+ .append("security_mode=\"").append(item.getStr("securityMode","auto")).append("\"\n")
|
|
|
+ .append("certificate=\"").append(
|
|
|
+ replaceSlash(item.getStr("certificate",""))
|
|
|
+ ).append("\"\n")
|
|
|
+ .append("private_key=\"").append(
|
|
|
+ replaceSlash(item.getStr("private_key",""))
|
|
|
+ ).append("\"\n");
|
|
|
Integer identityProvider = item.getInt("identityProvider");
|
|
|
if (identityProvider == 0) {
|
|
|
builder.append("auth_method=\"Anonymous\"\n");
|