aboutsummaryrefslogtreecommitdiffstats
path: root/grpc/grpc-server/src/main/java/org
diff options
context:
space:
mode:
authorKanagaraj Manickam <mkr1481@gmail.com>2019-03-13 11:30:10 +0800
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2019-03-13 11:31:04 +0800
commit0fa7bcf648503c5f112ec0dd0fc43b7de47311b2 (patch)
tree724ed38b43f678d5746c43e1c3dd30232c9666dd /grpc/grpc-server/src/main/java/org
parent1296994bacf273d263f5dcdad1b42db6192c866d (diff)
Add grpc server conf
Issue-ID: CLI-129 Change-Id: I24f15067093bbf351763d457ccbbbc81d3b226e8 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'grpc/grpc-server/src/main/java/org')
-rw-r--r--grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
index afbd7682..0c2f00b5 100644
--- a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
+++ b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
@@ -55,6 +55,7 @@ public class OpenInterfaceGrpcServer {
private static final String CONF_FILE = "oclip-grpc-server.properties";
private static final String CONF_SERVER_PORT = "oclip.grpc_server_port";
+ private static final String CONF_SERVER_HOST = "oclip.grpc_server_host";
static {
OnapCommandConfig.addProperties(CONF_FILE);
@@ -64,6 +65,10 @@ public class OpenInterfaceGrpcServer {
private void start(String portArg) throws IOException {
/* The port on which the server should run */
int port = Integer.parseInt(portArg == null ? OnapCommandConfig.getPropertyValue(CONF_SERVER_PORT) : portArg);
+ String host = OnapCommandConfig.getPropertyValue(CONF_SERVER_HOST);
+ if (host == null) {
+ host = InetAddress.getLocalHost().getHostAddress().trim();
+ }
server = ServerBuilder.forPort(port)
.addService(new OpenInterfaceGrpcImpl())
.build()
@@ -71,7 +76,7 @@ public class OpenInterfaceGrpcServer {
logger.info("Server started, listening on " + port);
try {
- OnapCommandRegistrar.getRegistrar().setHost(InetAddress.getLocalHost().getHostAddress().trim());
+ OnapCommandRegistrar.getRegistrar().setHost(host);
OnapCommandRegistrar.getRegistrar().setPort(port);
} catch (OnapCommandException e) {
//Never Occurs