Skip to content

Commit

Permalink
fix(anubis): add cors preflight catcher
Browse files Browse the repository at this point in the history
  • Loading branch information
WarriorsSami committed May 19, 2024
1 parent 9144823 commit 80f5651
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 47 deletions.
5 changes: 4 additions & 1 deletion anubis-eval/src/api/catchers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rocket::serde::json::{json, Value};
use rocket::{catch, error};
use rocket::{catch, error, options};

#[catch(401)]
pub fn unauthorized_catcher(req: &rocket::Request) -> Value {
Expand All @@ -24,3 +24,6 @@ pub fn internal_error_catcher(req: &rocket::Request) -> Value {
"error": "Internal server error"
})
}

#[options("/<_..>")]
pub fn cors_preflight() {}
43 changes: 0 additions & 43 deletions anubis-eval/src/api/cors.rs

This file was deleted.

1 change: 0 additions & 1 deletion anubis-eval/src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod catchers;
pub mod cors;
pub mod create_submission_endpoint;
pub mod evaluate_submission_job;
pub mod get_highest_score_submissions;
Expand Down
1 change: 1 addition & 0 deletions anubis-eval/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async fn rocket() -> _ {
.attach(Db::fairing())
.attach(AdHoc::on_ignite("Diesel Migrations", run_migrations))
.attach(Cors)
.mount("/", routes![api::catchers::cors_preflight])
.mount(
"/api",
routes![
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ services:
db:
condition: service_started
deploy:
replicas: 2
replicas: 1
profiles:
- anubis
- asgard
Expand All @@ -382,7 +382,7 @@ services:
<<: *default-logging
restart: always
deploy:
replicas: 2
replicas: 1
profiles:
- anubis
- asgard
Expand Down

0 comments on commit 80f5651

Please sign in to comment.