Files
openccb/services/lms-service/src/external_db.rs
T
Nurfog 53e5ef4d0b feat: Translate various strings and comments to Spanish for better localization
- Updated error messages and comments in main.rs, openapi.rs, portfolio.rs, predictive.rs, ai.rs, health.rs, middleware.rs, models.rs, token_limits.rs, and webhooks.rs to Spanish.
- Enhanced user experience by providing localized content for Spanish-speaking users.
2026-04-10 10:26:26 -04:00

27 lines
781 B
Rust

use sqlx::{MySql, Pool};
use std::env;
pub type MySqlPool = Pool<MySql>;
pub async fn init_mysql_pool() -> Option<MySqlPool> {
if let Ok(url) = env::var("MYSQL_DATABASE_URL") {
match sqlx::mysql::MySqlPoolOptions::new()
.max_connections(5)
.connect(&url)
.await
{
Ok(pool) => {
tracing::info!("Conectado a la base de datos MySQL externa");
Some(pool)
}
Err(e) => {
tracing::error!("Error al conectar a la base de datos MySQL externa: {}", e);
None
}
}
} else {
tracing::info!("MYSQL_DATABASE_URL no establecida, omitiendo la integración con la base de datos externa");
None
}
}