mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-04-27 14:42:16 +00:00
add nodecenterws config
This commit is contained in:
parent
aacd939408
commit
0a24986907
@ -162,7 +162,7 @@ public class CMHttpServer {
|
||||
String[] paths = cmdConf.startContract.split(",");
|
||||
for (String path : paths) {
|
||||
File f = new File(path);
|
||||
if (!f.getName().endsWith(".ypk"))
|
||||
if (!f.getName().endsWith(".ypk") || !f.exists())
|
||||
continue;
|
||||
Contract c = new Contract();
|
||||
c.setScript(f.getAbsolutePath());
|
||||
|
@ -45,6 +45,7 @@ public class GlobalConf {
|
||||
public String ipPort;
|
||||
public boolean isLAN = true;
|
||||
private String nodeCenterUrl; // 从ConfigDB读。
|
||||
private String nodeCenterWSUrl;
|
||||
|
||||
private static GlobalConf init() {
|
||||
java.util.logging.Logger.getLogger(org.bdware.bdledger.api.grpc.Client.class.getName())
|
||||
@ -157,6 +158,8 @@ public class GlobalConf {
|
||||
conf.isLAN = "true".equals(KeyValueDBUtil.instance.getValue(dbName, "isLAN"));
|
||||
conf.masterAddress = KeyValueDBUtil.instance.getValue(dbName, "masterAddress");
|
||||
conf.nodeCenterUrl = KeyValueDBUtil.instance.getValue(dbName, "nodeCenter");
|
||||
conf.nodeCenterWSUrl = KeyValueDBUtil.instance.getValue(dbName, "nodeCenterWS");
|
||||
|
||||
conf.peerID = KeyValueDBUtil.instance.getValue(dbName, "peerID");
|
||||
conf.keyPairStr = KeyValueDBUtil.instance.getValue(dbName, "keyPairStr");
|
||||
// logger.debug("keyPairStr" + conf.keyPairStr);
|
||||
@ -355,6 +358,19 @@ public class GlobalConf {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean resetNodeCenterWS(String val) {
|
||||
try {
|
||||
instance.nodeCenterWSUrl = val;
|
||||
KeyValueDBUtil.instance.setValue(CMTables.ConfigDB.toString(), "nodeCenterWS", val);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e.getMessage());
|
||||
LOGGER.debug(ExceptionUtil.exceptionToString(e));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean resetDeviceName(String val) {
|
||||
try {
|
||||
KeyValueDBUtil.instance.setValue(CMTables.ConfigDB.toString(), "nodeName", val);
|
||||
@ -460,6 +476,10 @@ public class GlobalConf {
|
||||
return instance.keyPair.getPublicKeyStr();
|
||||
}
|
||||
|
||||
public static String getNodeCenterWSUrl() {
|
||||
return instance.nodeCenterWSUrl;
|
||||
}
|
||||
|
||||
public boolean resetLicenceInternal(String licence2) {
|
||||
licence2 = licence2.replaceAll(" ", "+");
|
||||
LOGGER.info("resetLicence:" + licence2);
|
||||
|
@ -154,6 +154,7 @@ public class ManagerActions {
|
||||
data.put("clusterConnected", String.valueOf(NetworkManager.instance.isConnectedToNodeCenter()));
|
||||
data.put("nodePubKey", GlobalConf.instance.keyPair.getPublicKeyStr());
|
||||
data.put("masterAddress", GlobalConf.instance.masterAddress);
|
||||
data.put("nodeCenterWS",GlobalConf.getNodeCenterWSUrl());
|
||||
ReplyUtil.replyWithStatus(resultCallback, "onLoadNodeConfig", true, data);
|
||||
}
|
||||
|
||||
@ -163,6 +164,13 @@ public class ManagerActions {
|
||||
LOGGER.debug(JsonUtil.toJson(args));
|
||||
ReplyUtil.replyWithStatus(resultCallback, "onChangeNodeCenter", true, GlobalConf.resetNodeCenter(val));
|
||||
}
|
||||
@Action(userPermission = 1 << 10)
|
||||
public void changeNodeCenterWS(JsonObject args, ResultCallback resultCallback) {
|
||||
String val = args.get("data").getAsString();
|
||||
LOGGER.debug(JsonUtil.toJson(args));
|
||||
ReplyUtil.replyWithStatus(resultCallback, "onChangeNodeCenter", true, GlobalConf.resetNodeCenterWS(val));
|
||||
}
|
||||
|
||||
|
||||
@Action(userPermission = 1 << 10)
|
||||
public void changeBDledger(JsonObject args, ResultCallback resultCallback) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user