Skip to main content

init_db_pool

Function init_db_pool 

Source
pub async fn init_db_pool()
Expand description

Initializes the global database pool exactly once.

Reads PoolSettings from configuration and eagerly opens the pool so that a misconfigured or unreachable database fails fast at startup. Call this early in your application’s lifecycle (for example, in main).

§Panics

  • If database.url is not configured.
  • If the pool fails to connect.
  • If the pool has already been initialized.