support repoID in doip service

This commit is contained in:
CaiHQ 2023-06-09 18:59:55 +08:00
parent 50991a89d0
commit 9e55d56e85

View File

@ -12,8 +12,10 @@ import org.bdware.doip.endpoint.server.DoipServerImpl;
import org.bdware.doip.endpoint.server.DoipServiceInfo;
import org.bdware.doip.endpoint.server.StartServerCallback;
import org.bdware.sc.ContractProcess;
import org.bdware.sc.boundry.JavaScriptEntry;
import org.bdware.sc.crdt.SharableVarManager;
import org.bdware.sc.handler.DOOPRequestHandler;
import org.zz.gmhelper.SM2KeyPair;
import java.net.URI;
import java.util.ArrayList;
@ -63,13 +65,21 @@ public class DoipLocalSingleton {
} catch (Exception e) {
e.printStackTrace();
}
SM2KeyPair keyPair = JavaScriptEntry.getKeyPair();
String repoID = "bdtest/BDRepo/" + UUID.randomUUID().toString();
String owner = ContractProcess.instance.getContract().getOwner();
String repoType = "Repository";
String repoType = "BDO";
EndpointConfig config = null;
try {
if (otherConfigs != null && otherConfigs.isJsonObject()) {
config = new TempConfigStorage(otherConfigs.toString()).loadAsEndpointConfig();
if (otherConfigs.getAsJsonObject().has("repoID")) {
repoID = otherConfigs.getAsJsonObject().get("repoID").getAsString();
}
if (config.privateKey == null || config.publicKey == null) {
config.privateKey = keyPair.getPrivateKeyStr();
config.publicKey = keyPair.getPublicKeyStr();
}
if (config.routerURI != null) {
AuditIrpClient irpClient = new AuditIrpClient(config);
EndpointInfo endpointInfo = irpClient.getEndpointInfo();