fix: make github oauth client id optional

This commit is contained in:
daimond113 2024-10-14 14:59:16 +02:00
parent d2e04f49d0
commit 756b5c8257
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
3 changed files with 6 additions and 2 deletions

View file

@ -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 - Correct `pesde.toml` inclusion message in `publish` command by @daimond113
- Allow writes to files when `link` is false in PackageFS::write_to 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 - 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 ## [0.5.0-rc.5] - 2024-10-12
### Added ### Added

View file

@ -95,7 +95,9 @@ impl LoginCommand {
let config = source let config = source
.config(project) .config(project)
.context("failed to read index config")?; .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 let response = reqwest
.post(Url::parse_with_params( .post(Url::parse_with_params(

View file

@ -364,7 +364,8 @@ pub struct IndexConfig {
#[serde(default)] #[serde(default)]
pub wally_allowed: bool, pub wally_allowed: bool,
/// The OAuth client ID for GitHub /// The OAuth client ID for GitHub
pub github_oauth_client_id: String, #[serde(default)]
pub github_oauth_client_id: Option<String>,
/// The maximum size of an archive in bytes /// The maximum size of an archive in bytes
#[serde(default = "default_archive_size")] #[serde(default = "default_archive_size")]
pub max_archive_size: usize, pub max_archive_size: usize,