@@ -26,6 +26,7 @@ pub struct ServerConfig {
2626 pub keep_alive_timeout : Duration ,
2727 pub keep_alive_requests : u16 ,
2828 pub log_file : Option < String > ,
29+ pub setup_lib : Option < String > ,
2930
3031 #[ cfg( feature = "tls" ) ]
3132 pub tls_config : Option < Arc < rustls:: ServerConfig > > ,
@@ -38,6 +39,7 @@ impl fmt::Debug for ServerConfig {
3839 . field ( "pool_conf" , & self . pool_conf )
3940 . field ( "keep_alive_timeout" , & self . keep_alive_timeout )
4041 . field ( "keep_alive_requests" , & self . keep_alive_requests )
42+ . field ( "setup_lib" , & self . setup_lib )
4143 . field ( "log_file" , & self . log_file ) ;
4244
4345 #[ cfg( feature = "tls" ) ]
@@ -187,6 +189,9 @@ impl ServerConfig {
187189 let n: u8 = parse_next ! ( ) ;
188190 log:: set_level ( n. try_into ( ) ?) ;
189191 }
192+
193+ "--setup-lib" => conf. setup_lib = Some ( parse_next ! ( ) ) ,
194+
190195 #[ cfg( feature = "tls" ) ]
191196 "--tls" => tls = true ,
192197
@@ -378,7 +383,7 @@ impl ServerConfig {
378383
379384fn help ( ) -> ! {
380385 /* FIXME: Don't output tls options if the tls feature is disabled */
381- println ! ( concat! (
386+ println ! (
382387 "\
383388 http-srv: Copyright (C) 2025 Saúl Valdelvira
384389
@@ -397,6 +402,7 @@ PARAMETERS:
397402 -l, --log <file> Set log file
398403 -h, --help Display this help message
399404 --log-level <n> Set log level
405+ --setup-lib <file> Load the given file to setup the server
400406 --conf <file> Use the given config file instead of the default one
401407 --license Output the license of this program
402408
@@ -407,7 +413,7 @@ EXAMPLES:
407413 http-srv -p 8080 -d /var/html
408414 http-srv -d ~/desktop -n 1024 --keep-alive 120
409415 http-srv --log /var/log/http-srv.log"
410- ) ) ;
416+ ) ;
411417 process:: exit ( 0 ) ;
412418}
413419
@@ -444,7 +450,7 @@ impl Default for ServerConfig {
444450 keep_alive_timeout : Duration :: from_secs ( 0 ) ,
445451 keep_alive_requests : 10000 ,
446452 log_file : None ,
447-
453+ setup_lib : None ,
448454 #[ cfg( feature = "tls" ) ]
449455 tls_config : None ,
450456 }
0 commit comments