Skip to content

Commit

Permalink
Use beatmaps-service for .osu file retrieval (#15)
Browse files Browse the repository at this point in the history
* Use beatmaps-service for .osu file retrieval

* Rename k8s-deploy file

* take over prod

* stop takeover
  • Loading branch information
cmyui authored Jun 30, 2024
1 parent ae863cb commit 1ebd935
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_ENDPOINT_URL=
AWS_BUCKET_NAME=
BEATMAPS_SERVICE_BASE_URL=http://localhost:8000
SERVICE_READINESS_TIMEOUT=60
RUST_LOG=performance_service=info
File renamed without changes.
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,7 @@ pub struct Config {

#[clap(long, env)]
pub aws_secret_access_key: String,

#[clap(long, env)]
pub beatmaps_service_base_url: String,
}
6 changes: 3 additions & 3 deletions src/usecases/beatmaps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ pub async fn fetch_beatmap_osu_file(
None => {}
}

let osu_response = reqwest::get(&format!("https://old.ppy.sh/osu/{beatmap_id}"))
.await?
.error_for_status()?;
let base_url = &context.config.beatmaps_service_base_url;
let url = &format!("{base_url}/api/osu-api/v1/osu-files/{beatmap_id}");
let osu_response = reqwest::get(url).await?.error_for_status()?;

let response_bytes = osu_response.bytes().await?.to_vec();

Expand Down

0 comments on commit 1ebd935

Please sign in to comment.