From 3df6bc8f1a2ecec1313bd9b36ff7283f840b8308 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Tue, 18 Jun 2024 14:38:48 +0200 Subject: add server and secret as arguments --- src/config.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 01ab097..cd0b1c3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,7 @@ use serde::Deserialize; +use crate::cli::Args; + #[derive(Deserialize)] pub struct Config { pub server: String, @@ -45,4 +47,14 @@ impl Config { build.try_deserialize() } + + pub fn cli_override(&mut self, cli: &Args) -> &Self { + if let Some(server) = cli.server.to_owned() { + self.server = server + } + if let Some(secret) = cli.secret.to_owned() { + self.auth.secret = secret + } + self + } } -- cgit v1.2.3