Skip to content

Commit c399853

Browse files
author
Luis Sanchez
committed
[FAB-7989] --peerAddress should be --peer.address
leaving --peerAddress as an alias to --peer.address Change-Id: I587264405c53521eb87d01651c95800ead520e9b Signed-off-by: Luis Sanchez <sanchezl@us.ibm.com>
1 parent 308eb63 commit c399853

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

shim/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dependencies {
4848
compile 'io.grpc:grpc-netty:1.6.1'
4949
compile 'io.grpc:grpc-protobuf:1.6.1'
5050
compile 'io.grpc:grpc-stub:1.6.1'
51-
compile 'commons-cli:commons-cli:1.3.1'
51+
compile 'commons-cli:commons-cli:1.4'
5252
compile 'commons-logging:commons-logging:1.2'
5353
testCompile 'junit:junit:4.12'
5454
testCompile 'org.hamcrest:hamcrest-library:1.3'

shim/src/main/java/org/hyperledger/fabric/shim/ChaincodeBase.java

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@
66

77
package org.hyperledger.fabric.shim;
88

9-
import io.grpc.ManagedChannel;
10-
import io.grpc.netty.GrpcSslContexts;
11-
import io.grpc.netty.NegotiationType;
12-
import io.grpc.netty.NettyChannelBuilder;
13-
import io.netty.handler.ssl.SslContext;
9+
import static org.hyperledger.fabric.shim.Chaincode.Response.Status.INTERNAL_SERVER_ERROR;
10+
import static org.hyperledger.fabric.shim.Chaincode.Response.Status.SUCCESS;
11+
12+
import java.io.File;
13+
import java.io.PrintWriter;
14+
import java.io.StringWriter;
15+
import java.nio.charset.StandardCharsets;
16+
17+
import javax.net.ssl.SSLException;
18+
1419
import org.apache.commons.cli.CommandLine;
1520
import org.apache.commons.cli.DefaultParser;
1621
import org.apache.commons.cli.Options;
@@ -21,14 +26,11 @@
2126
import org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage.Type;
2227
import org.hyperledger.fabric.shim.impl.ChatStream;
2328

24-
import javax.net.ssl.SSLException;
25-
import java.io.File;
26-
import java.io.PrintWriter;
27-
import java.io.StringWriter;
28-
import java.nio.charset.StandardCharsets;
29-
30-
import static org.hyperledger.fabric.shim.Chaincode.Response.Status.INTERNAL_SERVER_ERROR;
31-
import static org.hyperledger.fabric.shim.Chaincode.Response.Status.SUCCESS;
29+
import io.grpc.ManagedChannel;
30+
import io.grpc.netty.GrpcSslContexts;
31+
import io.grpc.netty.NegotiationType;
32+
import io.grpc.netty.NettyChannelBuilder;
33+
import io.netty.handler.ssl.SslContext;
3234

3335
public abstract class ChaincodeBase implements Chaincode {
3436

@@ -79,14 +81,19 @@ public void start(String[] args) {
7981

8082
private void processCommandLineOptions(String[] args) {
8183
Options options = new Options();
82-
options.addOption("a", "peerAddress", true, "Address of peer to connect to");
84+
options.addOption("a", "peer.address", true, "Address of peer to connect to");
85+
options.addOption(null, "peerAddress", true, "Address of peer to connect to");
8386
options.addOption("s", "securityEnabled", false, "Present if security is enabled");
8487
options.addOption("i", "id", true, "Identity of chaincode");
8588
options.addOption("o", "hostNameOverride", true, "Hostname override for server certificate");
8689
try {
8790
CommandLine cl = new DefaultParser().parse(options, args);
88-
if (cl.hasOption('a')) {
89-
host = cl.getOptionValue('a');
91+
if (cl.hasOption("peerAddress") || cl.hasOption('a')) {
92+
if (cl.hasOption('a')) {
93+
host = cl.getOptionValue('a');
94+
} else {
95+
host = cl.getOptionValue("peerAddress");
96+
}
9097
port = new Integer(host.split(":")[1]);
9198
host = host.split(":")[0];
9299
}

0 commit comments

Comments
 (0)