summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2024-06-18 14:38:48 +0200
committerfxqnlr <[email protected]>2024-06-18 14:38:48 +0200
commit3df6bc8f1a2ecec1313bd9b36ff7283f840b8308 (patch)
treef780cf73a1a41de6a9314c6e5a6d1fa07fb8c37a /src/config.rs
parentb375657e660b199127a76683980a5d210a572ab7 (diff)
downloadwebol-cli-3df6bc8f1a2ecec1313bd9b36ff7283f840b8308.tar
webol-cli-3df6bc8f1a2ecec1313bd9b36ff7283f840b8308.tar.gz
webol-cli-3df6bc8f1a2ecec1313bd9b36ff7283f840b8308.zip
add server and secret as argumentsargs
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs12
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 @@
1use serde::Deserialize; 1use serde::Deserialize;
2 2
3use crate::cli::Args;
4
3#[derive(Deserialize)] 5#[derive(Deserialize)]
4pub struct Config { 6pub 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}