aboutsummaryrefslogtreecommitdiffstats
path: root/src/config/mod.rs
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2026-02-02 13:30:25 +0200
committerrtkay123 <dev@kanjala.com>2026-02-02 13:30:25 +0200
commit549d98f3b457ddfc6dffbe2fad406da4ac50ebc7 (patch)
treed1563d048eb7600f0f1265766efffb2797280051 /src/config/mod.rs
parente06094f23ca861ea5ae4864d11fa8ce8b7d7aa2c (diff)
downloadsellershut-549d98f3b457ddfc6dffbe2fad406da4ac50ebc7.tar.bz2
sellershut-549d98f3b457ddfc6dffbe2fad406da4ac50ebc7.zip
refactor: collapse auth
Diffstat (limited to 'src/config/mod.rs')
-rw-r--r--src/config/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 01af6d8..aa6f770 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -52,6 +52,7 @@ pub struct Api {
}
#[derive(Debug, Clone, Deserialize)]
+#[cfg(feature = "oauth")]
pub struct OAuth {
#[cfg(feature = "oauth-discord")]
pub discord: DiscordOauth,
@@ -71,21 +72,26 @@ pub struct DiscordOauth {
pub auth_url: Url,
}
+#[cfg(feature = "oauth-discord")]
fn discord_token_url() -> Url {
Url::parse("https://discord.com/api/oauth2/authorize?response_type=code").expect("valid url")
}
+#[cfg(feature = "oauth-discord")]
fn discord_auth_url() -> Url {
Url::parse("https://discord.com/api/oauth2/authorize?response_type=code").expect("valid url")
}
+#[cfg(feature = "oauth")]
fn redirect_url() -> Url {
Url::parse("http://127.0.0.1:2210/auth/authorised").expect("valid url")
}
+#[cfg(feature = "oauth")]
impl Default for OAuth {
fn default() -> Self {
Self {
+ #[cfg(feature = "oauth-discord")]
discord: DiscordOauth {
client_id: String::default(),
client_secret: SecretString::default(),