From 12af32b9eab9f1498abda0535cd51fa924d075f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Sun, 2 Jun 2019 13:35:01 +0200 Subject: [PATCH] Don't print DB URL --- src/db/mod.rs | 10 +++------- src/db/schemas/sqlite/schema.rs | 2 +- src/main.rs | 5 ++--- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/db/mod.rs b/src/db/mod.rs index 2751aea0..d45807b4 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -8,10 +8,9 @@ use rocket::http::Status; use rocket::request::{self, FromRequest}; use rocket::{Outcome, Request, State}; -use std::process::Command; -use chrono::prelude::*; use crate::error::Error; - +use chrono::prelude::*; +use std::process::Command; use crate::CONFIG; @@ -35,7 +34,6 @@ pub mod schema; #[path = "schemas/mysql/schema.rs"] pub mod schema; - /// Initializes a database pool. pub fn init_pool() -> Pool { let manager = ConnectionManager::new(CONFIG.database_url()); @@ -44,9 +42,7 @@ pub fn init_pool() -> Pool { } pub fn get_connection() -> Result { - let url = CONFIG.database_url(); - println!("{}", url.to_string()); - Connection::establish(&url) + Connection::establish(&CONFIG.database_url()) } /// Creates a back-up of the database using sqlite3 diff --git a/src/db/schemas/sqlite/schema.rs b/src/db/schemas/sqlite/schema.rs index 1bc924c9..750cecd3 100644 --- a/src/db/schemas/sqlite/schema.rs +++ b/src/db/schemas/sqlite/schema.rs @@ -169,4 +169,4 @@ allow_tables_to_appear_in_same_query!( users, users_collections, users_organizations, -); \ No newline at end of file +); diff --git a/src/main.rs b/src/main.rs index 4ff6c627..375bbcea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -128,8 +128,8 @@ fn chain_syslog(logger: fern::Dispatch) -> fern::Dispatch { } fn check_db() { - let url = CONFIG.database_url(); if cfg!(feature = "sqlite") { + let url = CONFIG.database_url(); let path = Path::new(&url); if let Some(parent) = path.parent() { @@ -149,7 +149,6 @@ fn check_db() { .expect("Failed to turn on WAL"); } } - println!("{}", url.to_string()); db::get_connection().expect("Can't connect to DB"); } @@ -217,7 +216,7 @@ fn check_web_vault() { // https://docs.rs/diesel_migrations/*/diesel_migrations/macro.embed_migrations.html #[allow(unused_imports)] mod migrations { - + #[cfg(feature = "sqlite")] embed_migrations!("migrations/sqlite"); #[cfg(feature = "mysql")]