@@ -188,21 +188,47 @@ pub async fn try_run(cli: DftArgs, config: AppConfig) -> Result<()> {
188188 execution_ctx. execute_ddl ( ) . await ;
189189 }
190190 let app_execution = AppExecution :: new ( execution_ctx) ;
191- let url = if let Some ( cmd) = cli. command . clone ( ) {
191+
192+ let ( addr, metrics_addr) = if let Some ( cmd) = cli. command . clone ( ) {
192193 match cmd {
193- Command :: ServeFlightSql { host, .. } => host,
194- _ => None ,
194+ Command :: ServeFlightSql {
195+ port : Some ( port) ,
196+ metrics_port : Some ( metrics_port) ,
197+ ..
198+ } => (
199+ format ! ( "localhost:{port}" ) ,
200+ format ! ( "0.0.0.0:{metrics_port}" ) ,
201+ ) ,
202+ Command :: ServeFlightSql {
203+ port : Some ( port) ,
204+ metrics_port : None ,
205+ ..
206+ } => (
207+ format ! ( "localhost:{port}" ) ,
208+ config. flightsql_server . server_metrics_port . clone ( ) ,
209+ ) ,
210+ Command :: ServeFlightSql {
211+ port : None ,
212+ metrics_port : Some ( metrics_port) ,
213+ ..
214+ } => (
215+ DEFAULT_SERVER_ADDRESS . to_string ( ) ,
216+ format ! ( "0.0.0.0:{metrics_port}" ) ,
217+ ) ,
218+
219+ _ => (
220+ DEFAULT_SERVER_ADDRESS . to_string ( ) ,
221+ config. flightsql_server . server_metrics_port . clone ( ) ,
222+ ) ,
195223 }
196224 } else {
197- None
225+ (
226+ DEFAULT_SERVER_ADDRESS . to_string ( ) ,
227+ config. flightsql_server . server_metrics_port . clone ( ) ,
228+ )
198229 } ;
199- let app = FlightSqlApp :: try_new (
200- app_execution,
201- & config,
202- & url. unwrap_or ( DEFAULT_SERVER_ADDRESS . to_string ( ) ) ,
203- & config. flightsql_server . server_metrics_port ,
204- )
205- . await ?;
230+
231+ let app = FlightSqlApp :: try_new ( app_execution, & config, & addr, & metrics_addr) . await ?;
206232 app. run ( ) . await ;
207233 Ok ( ( ) )
208234}
0 commit comments