@@ -27,13 +27,13 @@ impl Server {
2727
2828 pub async fn run ( self ) {
2929 let config = Arc :: clone ( & self . config ) ;
30- let address = config. address ( ) ;
30+ let address = config. address ;
3131 let handler = handler:: HttpHandler :: from ( Arc :: clone ( & config) ) ;
3232 let server = Arc :: new ( self ) ;
3333 let mut server_instances: Vec < tokio:: task:: JoinHandle < ( ) > > = Vec :: new ( ) ;
3434
35- if config. spa ( ) {
36- let mut index_html = config. root_dir ( ) ;
35+ if config. spa {
36+ let mut index_html = config. root_dir . clone ( ) ;
3737 index_html. push ( "index.html" ) ;
3838
3939 if !index_html. exists ( ) {
@@ -44,11 +44,11 @@ impl Server {
4444 }
4545 }
4646
47- if config. tls ( ) . is_some ( ) {
48- let https_config = config. tls ( ) . unwrap ( ) ;
47+ if config. tls . is_some ( ) {
48+ let https_config = config. tls . clone ( ) . unwrap ( ) ;
4949 let handler = handler. clone ( ) ;
50- let host = config. address ( ) . ip ( ) ;
51- let port = config. address ( ) . port ( ) . saturating_add ( 1 ) ;
50+ let host = config. address . ip ( ) ;
51+ let port = config. address . port ( ) . saturating_add ( 1 ) ;
5252 let address = SocketAddr :: new ( host, port) ;
5353 let server = Arc :: clone ( & server) ;
5454 let task = tokio:: spawn ( async move {
@@ -86,17 +86,17 @@ impl Server {
8686 }
8787 } ) ) ;
8888
89- if !self . config . quiet ( ) {
89+ if !self . config . quiet {
9090 println ! ( "Serving HTTP: http://{}" , address) ;
9191
92- if self . config . address ( ) . ip ( ) == Ipv4Addr :: from_str ( "0.0.0.0" ) . unwrap ( ) {
92+ if self . config . address . ip ( ) == Ipv4Addr :: from_str ( "0.0.0.0" ) . unwrap ( ) {
9393 if let Ok ( ip) = local_ip_address:: local_ip ( ) {
94- println ! ( "Local Network IP: http://{}:{}" , ip, self . config. port( ) ) ;
94+ println ! ( "Local Network IP: http://{}:{}" , ip, self . config. port) ;
9595 }
9696 }
9797 }
9898
99- if self . config . graceful_shutdown ( ) {
99+ if self . config . graceful_shutdown {
100100 let graceful = server. with_graceful_shutdown ( crate :: utils:: signal:: shutdown_signal ( ) ) ;
101101
102102 if let Err ( e) = graceful. await {
@@ -131,17 +131,17 @@ impl Server {
131131 }
132132 } ) ) ;
133133
134- if !self . config . quiet ( ) {
134+ if !self . config . quiet {
135135 println ! ( "Serving HTTPS: http://{}" , address) ;
136136
137- if self . config . address ( ) . ip ( ) == Ipv4Addr :: from_str ( "0.0.0.0" ) . unwrap ( ) {
137+ if self . config . address . ip ( ) == Ipv4Addr :: from_str ( "0.0.0.0" ) . unwrap ( ) {
138138 if let Ok ( ip) = local_ip_address:: local_ip ( ) {
139- println ! ( "Local Network IP: https://{}:{}" , ip, self . config. port( ) ) ;
139+ println ! ( "Local Network IP: https://{}:{}" , ip, self . config. port) ;
140140 }
141141 }
142142 }
143143
144- if self . config . graceful_shutdown ( ) {
144+ if self . config . graceful_shutdown {
145145 let graceful = server. with_graceful_shutdown ( crate :: utils:: signal:: shutdown_signal ( ) ) ;
146146
147147 if let Err ( e) = graceful. await {
0 commit comments