add debug for client config

This commit is contained in:
Edward Shen 2021-07-09 19:51:48 -04:00
parent 5300afa205
commit 3a855a7e4a
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 11 additions and 2 deletions

View file

@ -72,6 +72,7 @@ pub fn load_config() -> Result<Config, ConfigError> {
Ok(config) Ok(config)
} }
#[derive(Debug)]
/// Represents a fully parsed config, from a variety of sources. /// Represents a fully parsed config, from a variety of sources.
pub struct Config { pub struct Config {
pub cache_type: CacheType, pub cache_type: CacheType,
@ -199,10 +200,16 @@ struct YamlServerSettings {
external_ip: Option<IpAddr>, external_ip: Option<IpAddr>,
} }
// this intentionally does not implement display or debug // this intentionally does not implement display
#[derive(Deserialize, Serialize, Clone)] #[derive(Deserialize, Serialize, Clone)]
pub struct ClientSecret(String); pub struct ClientSecret(String);
impl std::fmt::Debug for ClientSecret {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "[client secret]")
}
}
#[derive(Deserialize, Default)] #[derive(Deserialize, Default)]
struct YamlExtendedOptions { struct YamlExtendedOptions {
memory_quota: Option<Mebibytes>, memory_quota: Option<Mebibytes>,
@ -213,7 +220,7 @@ struct YamlExtendedOptions {
cache_path: Option<PathBuf>, cache_path: Option<PathBuf>,
} }
#[derive(Deserialize, Copy, Clone)] #[derive(Deserialize, Copy, Clone, Debug)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum CacheType { pub enum CacheType {
OnDisk, OnDisk,

View file

@ -86,6 +86,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
return Err(e); return Err(e);
} }
debug!("{:?}", &config);
let client_secret = config.client_secret.clone(); let client_secret = config.client_secret.clone();
let client_secret_1 = config.client_secret.clone(); let client_secret_1 = config.client_secret.clone();