clonable config

This commit is contained in:
programmer programmer 2022-10-27 22:51:02 +02:00
parent 68360c0286
commit 5c7d50a8f5

View File

@ -6,12 +6,12 @@ use std::path::{Path, PathBuf};
use crate::cli::Cli; use crate::cli::Cli;
#[derive(Deserialize, Debug)] #[derive(Clone, Deserialize, Debug)]
pub struct Config { pub struct Config {
pub qbittorrent: ClientConfig, pub qbittorrent: ClientConfig,
} }
#[derive(Deserialize, Debug)] #[derive(Clone, Deserialize, Debug)]
pub struct ClientConfig { pub struct ClientConfig {
pub host: String, pub host: String,
pub port: usize, pub port: usize,
@ -19,7 +19,7 @@ pub struct ClientConfig {
pub password: String, pub password: String,
} }
#[derive(Debug, Snafu)] #[derive(Clone, Debug, Snafu)]
pub enum ConfigError { pub enum ConfigError {
#[snafu(display("Invalid configuration file format at: {path}"))] #[snafu(display("Invalid configuration file format at: {path}"))]
Config { source: toml::de::Error, path: String }, Config { source: toml::de::Error, path: String },