Commit fdc6dd7d authored by Robert Czechowski's avatar Robert Czechowski

Hide database passwords in logs in release builds. Fixes #72

parent 81abc517
......@@ -243,7 +243,13 @@ fn main() {
#[cfg(feature = "postgres")]
{
if let Some(url) = config.database_url.clone() {
#[cfg(feature = "debug")]
print!("Using database {} … ", &url);
#[cfg(not(feature = "debug"))]{
let (begin_middle, end) = url.split_at(url.find('@').unwrap_or(0));
let (begin, _middle) = begin_middle.split_at(begin_middle.rfind(':').unwrap_or(0));
print!("Using database {}:***{} … ", begin, end);
}
let conn = postgres::Connection::connect(url, postgres::TlsMode::None).unwrap();
println!("Connected");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment