1- use std:: fmt:: Write ;
2-
31use sqlpage:: {
4- app_config:: { self , AppConfig } ,
2+ app_config,
53 webserver:: { self , Database } ,
64 AppState ,
75} ;
@@ -21,41 +19,7 @@ async fn start() -> anyhow::Result<()> {
2119 webserver:: database:: migrations:: apply ( & app_config, & db) . await ?;
2220 let state = AppState :: init_with_db ( & app_config, db) . await ?;
2321 log:: debug!( "Starting server..." ) ;
24- let ( r, _) = tokio:: join!(
25- webserver:: http:: run_server( & app_config, state) ,
26- log_welcome_message( & app_config)
27- ) ;
28- r
29- }
30-
31- async fn log_welcome_message ( config : & AppConfig ) {
32- let address_message = if let Some ( unix_socket) = & config. unix_socket {
33- format ! ( "unix socket {unix_socket:?}" )
34- } else if let Some ( domain) = & config. https_domain {
35- format ! ( "https://{}" , domain)
36- } else {
37- let listen_on = config. listen_on ( ) ;
38- let mut msg = format ! ( "{listen_on}" ) ;
39- if listen_on. ip ( ) . is_unspecified ( ) {
40- // let the user know the service is publicly accessible
41- write ! (
42- msg,
43- ": accessible from the network, and locally on http://localhost:{}" ,
44- listen_on. port( )
45- )
46- . unwrap ( ) ;
47- }
48- msg
49- } ;
50-
51- log:: info!(
52- "SQLPage v{} started successfully.
53- Now listening on {}
54- You can write your website's code in .sql files in {}" ,
55- env!( "CARGO_PKG_VERSION" ) ,
56- address_message,
57- config. web_root. display( )
58- ) ;
22+ webserver:: http:: run_server ( & app_config, state) . await
5923}
6024
6125fn init_logging ( ) {
0 commit comments