@@ -23,6 +23,12 @@ const OPTION_GRPC_PORT: options::DefaultIntegerConfigOption = options::ConfigOpt
2323 "Which port should the grpc plugin listen for incoming connections?"
2424) ;
2525
26+ const OPTION_GRPC_HOST : options:: DefaultStringConfigOption = options:: ConfigOption :: new_str_with_default (
27+ "grpc-host" ,
28+ "127.0.0.1" ,
29+ "Which host should the grpc listen for incomming connections?"
30+ ) ;
31+
2632const OPTION_GRPC_MSG_BUFFER_SIZE : options:: DefaultIntegerConfigOption = options:: ConfigOption :: new_i64_with_default (
2733 "grpc-msg-buffer-size" ,
2834 1024 ,
@@ -36,6 +42,7 @@ async fn main() -> Result<()> {
3642
3743 let plugin = match Builder :: new ( tokio:: io:: stdin ( ) , tokio:: io:: stdout ( ) )
3844 . option ( OPTION_GRPC_PORT )
45+ . option ( OPTION_GRPC_HOST )
3946 . option ( OPTION_GRPC_MSG_BUFFER_SIZE )
4047 // TODO: Use the catch-all subscribe method
4148 // However, doing this breaks the plugin at the time begin
@@ -55,6 +62,7 @@ async fn main() -> Result<()> {
5562 } ;
5663
5764 let bind_port: i64 = plugin. option ( & OPTION_GRPC_PORT ) . unwrap ( ) ;
65+ let bind_host: String = plugin. option ( & OPTION_GRPC_HOST ) . unwrap ( ) ;
5866 let buffer_size: i64 = plugin. option ( & OPTION_GRPC_MSG_BUFFER_SIZE ) . unwrap ( ) ;
5967 let buffer_size = match usize:: try_from ( buffer_size) {
6068 Ok ( b) => b,
@@ -79,7 +87,7 @@ async fn main() -> Result<()> {
7987
8088 let plugin = plugin. start ( state. clone ( ) ) . await ?;
8189
82- let bind_addr: SocketAddr = format ! ( "0.0.0.0 :{}" , bind_port) . parse ( ) . unwrap ( ) ;
90+ let bind_addr: SocketAddr = format ! ( "{} :{}" , bind_host , bind_port) . parse ( ) . unwrap ( ) ;
8391
8492 tokio:: select! {
8593 _ = plugin. join( ) => {
0 commit comments