From 756b5c82575650f8fda457dd415044fd3221d837 Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:59:16 +0200 Subject: [PATCH] fix: make github oauth client id optional --- CHANGELOG.md | 1 + src/cli/commands/auth/login.rs | 4 +++- src/source/pesde/mod.rs | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d63c31a..687380a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Correct `pesde.toml` inclusion message in `publish` command by @daimond113 - Allow writes to files when `link` is false in PackageFS::write_to by @daimond113 - Handle missing revisions in AnyPackageIdentifier::from_str by @daimond113 +- Make GitHub OAuth client ID config optional by @daimond113 ## [0.5.0-rc.5] - 2024-10-12 ### Added diff --git a/src/cli/commands/auth/login.rs b/src/cli/commands/auth/login.rs index b451777..c430e1d 100644 --- a/src/cli/commands/auth/login.rs +++ b/src/cli/commands/auth/login.rs @@ -95,7 +95,9 @@ impl LoginCommand { let config = source .config(project) .context("failed to read index config")?; - let client_id = config.github_oauth_client_id; + let Some(client_id) = config.github_oauth_client_id else { + anyhow::bail!("index not configured for Github oauth."); + }; let response = reqwest .post(Url::parse_with_params( diff --git a/src/source/pesde/mod.rs b/src/source/pesde/mod.rs index 3dac8e0..c281dbb 100644 --- a/src/source/pesde/mod.rs +++ b/src/source/pesde/mod.rs @@ -364,7 +364,8 @@ pub struct IndexConfig { #[serde(default)] pub wally_allowed: bool, /// The OAuth client ID for GitHub - pub github_oauth_client_id: String, + #[serde(default)] + pub github_oauth_client_id: Option, /// The maximum size of an archive in bytes #[serde(default = "default_archive_size")] pub max_archive_size: usize,