File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
datafusion-postgres-cli/src Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ struct Opt {
3030 /// Avro files to register as table, using syntax `table_name:file_path`
3131 #[ structopt( long( "avro" ) ) ]
3232 avro_tables : Vec < String > ,
33+ /// Port the server listens to, default to 5432
34+ #[ structopt( short, default_value = "5432" ) ]
35+ port : u16 ,
36+ /// Host address the server listens to, default to 127.0.0.1
37+ #[ structopt( long( "host" ) , default_value = "127.0.0.1" ) ]
38+ host : String ,
3339}
3440
3541fn parse_table_def ( table_def : & str ) -> ( & str , & str ) {
@@ -96,8 +102,8 @@ async fn main() {
96102 session_context,
97103 ) ) ) ) ;
98104
99- let server_addr = "127.0.0.1:5432" ;
100- let listener = TcpListener :: bind ( server_addr) . await . unwrap ( ) ;
105+ let server_addr = format ! ( "{}:{}" , opts . host , opts . port ) ;
106+ let listener = TcpListener :: bind ( & server_addr) . await . unwrap ( ) ;
101107 println ! ( "Listening to {}" , server_addr) ;
102108 loop {
103109 let incoming_socket = listener. accept ( ) . await . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments