aboutsummaryrefslogtreecommitdiffstats
path: root/src/config/cli.rs
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2026-02-01 15:20:13 +0200
committerrtkay123 <dev@kanjala.com>2026-02-01 15:20:13 +0200
commit78f61ccdf66572d7432b5b627994038479103653 (patch)
tree3b752267d04d041c35efe5a9f5c732988179f020 /src/config/cli.rs
parentce65d9eeafcd1f9d5c3adef1c9b1af6258ee711a (diff)
downloadsellershut-78f61ccdf66572d7432b5b627994038479103653.tar.bz2
sellershut-78f61ccdf66572d7432b5b627994038479103653.zip
feat: oauth from config
Diffstat (limited to 'src/config/cli.rs')
-rw-r--r--src/config/cli.rs23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/config/cli.rs b/src/config/cli.rs
index dab7216..5254135 100644
--- a/src/config/cli.rs
+++ b/src/config/cli.rs
@@ -1,6 +1,7 @@
use std::path::PathBuf;
use clap::Parser;
+use serde::Deserialize;
use url::Url;
use crate::config::{logging::LogLevel, port::port_in_range};
@@ -49,25 +50,33 @@ pub struct Cli {
pub oauth: Option<OAuth>,
}
-#[derive(Debug, Clone, Parser)]
+#[derive(Debug, Clone, Parser, Deserialize)]
pub struct OAuth {
#[cfg(feature = "oauth-discord")]
#[command(flatten)]
discord: DiscordOauth,
- #[arg(long)]
+ #[arg(long, env = "OAUTH_REDIRECT_URL")]
oauth_redirect_url: Option<Url>,
}
#[cfg(feature = "oauth-discord")]
-#[derive(Debug, Clone, Parser)]
+#[derive(Debug, Clone, Parser, Deserialize)]
pub struct DiscordOauth {
- #[arg(long)]
+ #[arg(long, env = "OAUTH_DISCORD_CLIENT_ID")]
discord_client_id: Option<String>,
- #[arg(long)]
+ #[arg(long, env = "OAUTH_DISCORD_CLIENT_SECRET")]
discord_client_secret: Option<String>,
- #[arg(long)]
+ #[arg(
+ long,
+ env = "OAUTH_DISCORD_TOKEN_URL",
+ default_value = "https://discord.com/api/oauth2/token"
+ )]
discord_token_url: Option<Url>,
- #[arg(long)]
+ #[arg(
+ long,
+ env = "OAUTH_DISCORD_AUTH_URL",
+ default_value = "https://discord.com/api/oauth2/authorize?response_type=code"
+ )]
discord_auth_url: Option<Url>,
}