Skip to content

Commit

Permalink
Debug workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshaughnessy committed Nov 7, 2023
1 parent 3d076b2 commit 029908a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ services:
track-server:
image: us-central1-docker.pkg.dev/hubs-dev-333333/ocho-osai/johnshaughnessy/track/track-server
volumes:
- ./track:/track
- ./:/track
4 changes: 2 additions & 2 deletions server/src/api/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ pub async fn post_weights(
}

pub async fn get_weights(pool: web::Data<Pool<ConnectionManager<PgConnection>>>) -> impl Responder {
log::info!("get_weights");
let mut conn = pool.get().unwrap();

match server::models::weights::read_weights(&mut conn) {
Ok(weights) => HttpResponse::Ok().json(weights),
Err(e) => {
HttpResponse::InternalServerError().body(format!("Error retrieving weights: {:?}", e))
}
// Err(_) => HttpResponse::InternalServerError().body("Error retrieving weights."),
} // Err(_) => HttpResponse::InternalServerError().body("Error retrieving weights."),
}
}

Expand Down
6 changes: 3 additions & 3 deletions server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ async fn main() -> std::io::Result<()> {
.allowed_header(http::header::CONTENT_TYPE)
.max_age(3600),
ref x if x == "prod" => Cors::default()
.allowed_origin("https://www.example.com")
.allow_any_origin()
.allowed_methods(vec!["GET", "POST", "PATCH", "DELETE"])
.allowed_headers(vec![http::header::AUTHORIZATION, http::header::ACCEPT])
.allowed_header(http::header::CONTENT_TYPE)
.max_age(3600),
_ => panic!("APP_ENV must be set to either 'dev' or 'prod'"),
};

println!("APP_ENV: {:?}", std::env::var("APP_ENV"));
println!("cors: {:?}", cors);
log::info!("APP_ENV: {:?}", std::env::var("APP_ENV"));
log::info!("cors: {:?}", cors);

App::new()
.wrap(cors)
Expand Down

0 comments on commit 029908a

Please sign in to comment.