diff --git a/src/config.rs b/src/config.rs index 56129407..c7fce635 100644 --- a/src/config.rs +++ b/src/config.rs @@ -298,6 +298,9 @@ pub struct General { pub admin_username: String, pub admin_password: String, + #[serde(default = "General::default_validate_config")] + pub validate_config: bool, + // Support for auth query pub auth_query: Option, pub auth_query_user: Option, @@ -367,6 +370,10 @@ impl General { pub fn default_idle_client_in_transaction_timeout() -> u64 { 0 } + + pub fn default_validate_config() -> bool { + true + } } impl Default for General { @@ -402,6 +409,7 @@ impl Default for General { auth_query_user: None, auth_query_password: None, server_lifetime: 1000 * 3600 * 24, // 24 hours, + validate_config: true, } } } diff --git a/src/pool.rs b/src/pool.rs index 2fd380ce..27ff8616 100644 --- a/src/pool.rs +++ b/src/pool.rs @@ -459,10 +459,12 @@ impl ConnectionPool { // Connect to the servers to make sure pool configuration is valid // before setting it globally. // Do this async and somewhere else, we don't have to wait here. - let mut validate_pool = pool.clone(); - tokio::task::spawn(async move { - let _ = validate_pool.validate().await; - }); + if config.general.validate_config { + let mut validate_pool = pool.clone(); + tokio::task::spawn(async move { + let _ = validate_pool.validate().await; + }); + } // There is one pool per database/user pair. new_pools.insert(PoolIdentifier::new(pool_name, &user.username), pool);