From 85d469196ff17a3aee7a950ae57d4797938e8f42 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 15 May 2018 11:35:19 -0700 Subject: fix build (non-functional though) --- rust/src/api_server.rs | 4 +++- rust/src/bin/fatcat-iron.rs | 10 ++++++++-- rust/src/lib.rs | 1 - 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index cac222e6..77ac324b 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -33,16 +33,18 @@ impl Api for Server { context: &Context, ) -> Box + Send> { let context = context.clone(); - let con: DieselPooledConnection = req.db_conn(); + //let con: DieselPooledConnection = req.db_conn(); println!( "container_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone() ); + /* println!( "container count: {}", containers.count().load(&con).expect("DB Error"), ); + */ Box::new(futures::failed("Generic failure".into())) } diff --git a/rust/src/bin/fatcat-iron.rs b/rust/src/bin/fatcat-iron.rs index 1f443e8e..d89a9c53 100644 --- a/rust/src/bin/fatcat-iron.rs +++ b/rust/src/bin/fatcat-iron.rs @@ -5,6 +5,9 @@ extern crate clap; extern crate fatcat; extern crate fatcat_api; extern crate futures; +extern crate dotenv; +extern crate diesel; +extern crate iron_diesel_middleware; extern crate iron; extern crate iron_slog; extern crate swagger; @@ -18,6 +21,9 @@ use iron_slog::{LoggerMiddleware, DefaultLogFormatter}; use clap::{App, Arg}; use iron::{Chain, Iron}; use swagger::auth::AllowAllMiddleware; +use dotenv::dotenv; +use std::env; +use iron_diesel_middleware::{DieselMiddleware, DieselPooledConnection, DieselReqExt}; /// Create custom server, wire it to the autogenerated router, /// and pass it to the web server. @@ -40,7 +46,7 @@ fn main() { dotenv().ok(); let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); - let diesel_middleware: DieselMiddleware = DieselMiddleware::new(database_url).unwrap(); + let diesel_middleware: DieselMiddleware = DieselMiddleware::new(&database_url).unwrap(); let server = fatcat::server().unwrap(); let router = fatcat_api::router(server); @@ -54,7 +60,7 @@ fn main() { chain.link_before(AllowAllMiddleware::new("cosmo")); chain.link_after(fatcat::XClacksOverheadMiddleware); - chain.link_before(diesel_middleware); + //chain.link_before(diesel_middleware); if matches.is_present("https") { unimplemented!() diff --git a/rust/src/lib.rs b/rust/src/lib.rs index fecea06e..ae39224f 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -24,7 +24,6 @@ use std::env; use hyper::header::Headers; use iron::{Request, Response}; use iron::middleware::AfterMiddleware; -use iron_diesel_middleware::{DieselMiddleware, DieselPooledConnection, DieselReqExt}; pub fn establish_connection() -> PgConnection { dotenv().ok(); -- cgit v1.2.3