From 1f76530bc5001d9a9088f269db6c03cf287b67e6 Mon Sep 17 00:00:00 2001 From: rtkay123 Date: Mon, 2 Feb 2026 17:09:32 +0200 Subject: feat: create auth session --- src/config/cli.rs | 8 +++++--- src/config/mod.rs | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/config') diff --git a/src/config/cli.rs b/src/config/cli.rs index 7bc6312..be1b913 100644 --- a/src/config/cli.rs +++ b/src/config/cli.rs @@ -1,6 +1,8 @@ use std::path::PathBuf; use clap::Parser; +#[cfg(feature = "oauth-discord")] +use secrecy::SecretString; use serde::Deserialize; use url::Url; @@ -48,7 +50,7 @@ pub struct Cli { /// Oauth optionas #[command(flatten)] #[cfg(feature = "oauth")] - pub oauth: Option, + pub oauth: OAuth, } #[derive(Debug, Clone, Parser, Deserialize)] @@ -61,12 +63,12 @@ pub struct OAuth { } #[cfg(feature = "oauth-discord")] -#[derive(Debug, Clone, Parser, Deserialize)] +#[derive(Debug, Clone, Parser, Deserialize, Default)] pub struct DiscordOauth { #[arg(long, env = "OAUTH_DISCORD_CLIENT_ID")] discord_client_id: Option, #[arg(long, env = "OAUTH_DISCORD_CLIENT_SECRET")] - discord_client_secret: Option, + discord_client_secret: Option, #[arg( long, env = "OAUTH_DISCORD_TOKEN_URL", diff --git a/src/config/mod.rs b/src/config/mod.rs index aa6f770..0c53f08 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -74,7 +74,7 @@ pub struct DiscordOauth { #[cfg(feature = "oauth-discord")] fn discord_token_url() -> Url { - Url::parse("https://discord.com/api/oauth2/authorize?response_type=code").expect("valid url") + Url::parse("https://discord.com/api/oauth2/token").expect("valid url") } #[cfg(feature = "oauth-discord")] @@ -195,6 +195,7 @@ impl Config { if let Some(db_url) = &cli.db { dsn.url = db_url.clone(); } + } } -- cgit v1.2.3