diff options
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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 @@ | |||
1 | use serde::Deserialize; | 1 | use serde::Deserialize; |
2 | 2 | ||
3 | use crate::cli::Args; | ||
4 | |||
3 | #[derive(Deserialize)] | 5 | #[derive(Deserialize)] |
4 | pub struct Config { | 6 | pub struct Config { |
5 | pub server: String, | 7 | pub server: String, |
@@ -45,4 +47,14 @@ impl Config { | |||
45 | 47 | ||
46 | build.try_deserialize() | 48 | build.try_deserialize() |
47 | } | 49 | } |
50 | |||
51 | pub fn cli_override(&mut self, cli: &Args) -> &Self { | ||
52 | if let Some(server) = cli.server.to_owned() { | ||
53 | self.server = server | ||
54 | } | ||
55 | if let Some(secret) = cli.secret.to_owned() { | ||
56 | self.auth.secret = secret | ||
57 | } | ||
58 | self | ||
59 | } | ||
48 | } | 60 | } |