Skip to content

Commit

Permalink
fix: s3 only routes are not handled (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum authored Nov 5, 2022
1 parent 4dd7fd3 commit 72d732a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use browse::list;
use common::{Config, IntelMission, Metrics};
use error::{Error, Result};
use queue::queue_length;
use repos::{index, repo_routes};
use repos::{configure_repo_routes, index};
use storage::check_s3;
use utils::not_found;

Expand Down Expand Up @@ -154,6 +154,7 @@ async fn main() {
App::new()
.app_data(web::Data::new(mission.clone()))
.app_data(web::Data::from(config.clone()))
.route("/metrics", web::get().to(metrics_endpoint))
.route(
"/{path:.*}",
web::get()
Expand All @@ -162,8 +163,7 @@ async fn main() {
}))
.to(list),
)
.route("/metrics", web::get().to(metrics_endpoint))
.service(repo_routes())
.configure(configure_repo_routes)
.route("/{path:.*}", web::get().to(index))
.default_service(web::route().to(not_found))
.wrap_fn(queue_length)
Expand Down
8 changes: 4 additions & 4 deletions src/repos.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use actix_web::http::{Method, Uri};
use actix_web::{guard, web, HttpResponse, Route, Scope};
use actix_web::{guard, web, HttpResponse, Route};
use lazy_static::lazy_static;
use regex::Regex;

Expand Down Expand Up @@ -173,8 +173,8 @@ pub fn gradle_allow(_config: &Config, path: &str) -> bool {
path.ends_with(".zip")
}

pub fn repo_routes() -> Scope {
web::scope("")
pub fn configure_repo_routes(config: &mut web::ServiceConfig) {
config
.route(
"/crates.io/{path:.+}",
simple_intel(|c| &c.crates_io, "crates.io", allow_all, disallow_all),
Expand Down Expand Up @@ -296,7 +296,7 @@ pub fn repo_routes() -> Scope {
.route(
"/nix-channels/store/{path:.+}",
nix_intel(|c| &c.nix_channels_store, "nix-channels/store"),
)
);
}

pub async fn dart_pub(
Expand Down

0 comments on commit 72d732a

Please sign in to comment.