Add grpc server conf 80/82080/1
authorKanagaraj Manickam <mkr1481@gmail.com>
Wed, 13 Mar 2019 03:30:10 +0000 (11:30 +0800)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Wed, 13 Mar 2019 03:31:04 +0000 (11:31 +0800)
Issue-ID: CLI-129

Change-Id: I24f15067093bbf351763d457ccbbbc81d3b226e8
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
deployment/zip/src/main/release/conf/oclip-grpc-server.properties
grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
grpc/grpc-server/src/main/resources/oclip-grpc-server.properties

index 972fdeb..c745439 100644 (file)
@@ -12,4 +12,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-oclip.grpc_server_port=50051
\ No newline at end of file
+oclip.grpc_server_port=50051
+oclip.grpc_server_host=localhost
\ No newline at end of file
index afbd768..0c2f00b 100644 (file)
@@ -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
index 972fdeb..c745439 100644 (file)
@@ -12,4 +12,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-oclip.grpc_server_port=50051
\ No newline at end of file
+oclip.grpc_server_port=50051
+oclip.grpc_server_host=localhost
\ No newline at end of file