From ecc05a2812563b1165e4c761f0695c8ce5373c1d Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 30 Dec 2023 00:22:21 +0100 Subject: [PATCH] Make config username + password fields private --- src/config.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 7a299b6..bed8cbb 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,11 +1,12 @@ +use lemmy_api_common::sensitive::Sensitive; use serde_derive::{Deserialize, Serialize}; use crate::config::PostBody::Description; #[derive(Serialize, Deserialize, Clone, Debug)] pub(crate) struct Config { pub(crate) instance: String, - pub(crate) username: String, - pub(crate) password: String, + username: String, + password: String, pub(crate) status_post_url: Option, pub(crate) config_reload_seconds: u32, pub(crate) protected_communities: Vec, @@ -38,6 +39,14 @@ impl Config { }); cfg } + + pub(crate) fn get_username(&self) -> Sensitive { + Sensitive::new(self.username.clone()) + } + + pub(crate) fn get_password(&self) -> Sensitive { + Sensitive::new(self.password.clone()) + } } impl Default for Config {