Now rading database from env var
All checks were successful
Build Project / test (push) Successful in 5m39s

This commit is contained in:
2023-09-26 21:10:40 +00:00
parent b03801e12f
commit 01f1219f55
2 changed files with 15 additions and 4 deletions

View File

@@ -18,10 +18,10 @@ pub enum DatabaseError {
}
impl Database {
pub async fn init(host: &str, user: &str, pass: &str, db_name: &str) -> Database {
pub async fn init(database_url: &str) -> Database {
match PgPoolOptions::new()
.max_connections(10)
.connect(&format!("postgres://{user}:{pass}@{host}/{db_name}"))
.connect(database_url)
.await
{
Ok(pool) => {