generated from OBJNULL/Dockerized-Rust
22 lines
No EOL
505 B
Rust
22 lines
No EOL
505 B
Rust
// Libraries
|
|
use std::error::Error;
|
|
|
|
pub mod conf;
|
|
pub mod database;
|
|
|
|
use conf::Conf;
|
|
use database::Database;
|
|
|
|
// Functions
|
|
pub fn init_db(conf: &Conf) -> Result<Database, Box<dyn Error>> {
|
|
// Initilizing & Connecting to Database
|
|
let mut database: Database = Database::init();
|
|
database.connect(
|
|
conf.get_string("database.address")?,
|
|
conf.get_string("database.user")?,
|
|
conf.get_string("database.pass")?
|
|
)?;
|
|
|
|
// Returning database
|
|
return Ok(database);
|
|
} |