Merge pull request #925 from AppFlowy-IO/masked-postgres-password
fix: masked postgres password in logs
This commit is contained in:
commit
3247c8c9c6
|
|
@ -3,7 +3,7 @@ use collab_stream::client::CONTROL_STREAM_KEY;
|
|||
use infra::env_util::get_env_var;
|
||||
use serde::Deserialize;
|
||||
use sqlx::postgres::{PgConnectOptions, PgSslMode};
|
||||
use std::str::FromStr;
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config {
|
||||
|
|
@ -64,6 +64,17 @@ impl DatabaseSetting {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for DatabaseSetting {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let masked_pg_conn_opts = self.pg_conn_opts.clone().password("********");
|
||||
write!(
|
||||
f,
|
||||
"DatabaseSetting {{ pg_conn_opts: {:?}, require_ssl: {}, max_connections: {} }}",
|
||||
masked_pg_conn_opts, self.require_ssl, self.max_connections
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct StreamSetting {
|
||||
/// The key of the stream that contains control event, [CollabControlEvent].
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use mailer::config::MailerSetting;
|
|||
use secrecy::Secret;
|
||||
use serde::Deserialize;
|
||||
use sqlx::postgres::{PgConnectOptions, PgSslMode};
|
||||
use std::str::FromStr;
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config {
|
||||
|
|
@ -79,6 +79,17 @@ impl DatabaseSetting {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for DatabaseSetting {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let masked_pg_conn_opts = self.pg_conn_opts.clone().password("********");
|
||||
write!(
|
||||
f,
|
||||
"DatabaseSetting {{ pg_conn_opts: {:?}, require_ssl: {}, max_connections: {} }}",
|
||||
masked_pg_conn_opts, self.require_ssl, self.max_connections
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct StreamSetting {
|
||||
/// The key of the stream that contains control event, [CollabControlEvent].
|
||||
|
|
|
|||
|
|
@ -115,10 +115,11 @@ pub struct DatabaseSetting {
|
|||
|
||||
impl Display for DatabaseSetting {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let masked_pg_conn_opts = self.pg_conn_opts.clone().password("********");
|
||||
write!(
|
||||
f,
|
||||
"DatabaseSetting {{ pg_conn_opts: {:?}, require_ssl: {}, max_connections: {} }}",
|
||||
self.pg_conn_opts, self.require_ssl, self.max_connections
|
||||
masked_pg_conn_opts, self.require_ssl, self.max_connections
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue