Merge branch 'main' into var-interpolation
This commit is contained in:
@@ -409,4 +409,23 @@ mod tests {
|
||||
"https://dontdo:this@testing.com/query?test=%20query#results"
|
||||
);
|
||||
}
|
||||
|
||||
fn test_servarr_config_redacted_debug() {
|
||||
let host = "localhost".to_owned();
|
||||
let port = 1234;
|
||||
let uri = "http://localhost:1234".to_owned();
|
||||
let api_token = "thisisatest".to_owned();
|
||||
let ssl_cert_path = "/some/path".to_owned();
|
||||
let expected_str = format!("ServarrConfig {{ host: Some(\"{}\"), port: Some({}), uri: Some(\"{}\"), api_token: \"***********\", ssl_cert_path: Some(\"{}\") }}",
|
||||
host, port, uri, ssl_cert_path);
|
||||
let servarr_config = ServarrConfig {
|
||||
host: Some(host),
|
||||
port: Some(port),
|
||||
uri: Some(uri),
|
||||
api_token,
|
||||
ssl_cert_path: Some(ssl_cert_path),
|
||||
};
|
||||
|
||||
assert_str_eq!(format!("{servarr_config:?}"), expected_str);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -7,6 +7,7 @@ use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::mpsc::Sender;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use veil::Redact;
|
||||
|
||||
use crate::app::context_clues::{build_context_clue_string, SERVARR_CONTEXT_CLUES};
|
||||
use crate::cli::Command;
|
||||
@@ -43,7 +44,7 @@ pub struct App<'a> {
|
||||
pub data: Data<'a>,
|
||||
}
|
||||
|
||||
impl<'a> App<'a> {
|
||||
impl App<'_> {
|
||||
pub fn new(
|
||||
network_tx: Sender<NetworkEvent>,
|
||||
config: AppConfig,
|
||||
@@ -166,7 +167,7 @@ impl<'a> App<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Default for App<'a> {
|
||||
impl Default for App<'_> {
|
||||
fn default() -> Self {
|
||||
App {
|
||||
navigation_stack: Vec::new(),
|
||||
@@ -259,7 +260,7 @@ impl AppConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[derive(Redact, Deserialize, Serialize, Clone)]
|
||||
pub struct ServarrConfig {
|
||||
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
||||
pub host: Option<String>,
|
||||
@@ -268,6 +269,7 @@ pub struct ServarrConfig {
|
||||
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
||||
pub uri: Option<String>,
|
||||
#[serde(default, deserialize_with = "deserialize_env_var")]
|
||||
#[redact]
|
||||
pub api_token: String,
|
||||
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
||||
pub ssl_cert_path: Option<String>,
|
||||
|
||||
@@ -8,7 +8,7 @@ pub mod radarr_context_clues;
|
||||
#[path = "radarr_tests.rs"]
|
||||
mod radarr_tests;
|
||||
|
||||
impl<'a> App<'a> {
|
||||
impl App<'_> {
|
||||
pub(super) async fn dispatch_by_radarr_block(&mut self, active_radarr_block: &ActiveRadarrBlock) {
|
||||
match active_radarr_block {
|
||||
ActiveRadarrBlock::Blocklist => {
|
||||
|
||||
@@ -11,7 +11,7 @@ pub mod sonarr_context_clues;
|
||||
#[path = "sonarr_tests.rs"]
|
||||
mod sonarr_tests;
|
||||
|
||||
impl<'a> App<'a> {
|
||||
impl App<'_> {
|
||||
pub(super) async fn dispatch_by_sonarr_block(&mut self, active_sonarr_block: &ActiveSonarrBlock) {
|
||||
match active_sonarr_block {
|
||||
ActiveSonarrBlock::Series => {
|
||||
|
||||
Reference in New Issue
Block a user