summaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/api_server.rs7
-rw-r--r--rust/src/bin/fatcat-iron.rs9
-rw-r--r--rust/src/lib.rs6
3 files changed, 5 insertions, 17 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index 3e2e6c9c..2dd1bd8c 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -11,9 +11,8 @@ use self::models::*;
use ConnectionPool;
use diesel;
use diesel::prelude::*;
-use iron_diesel_middleware::DieselPooledConnection;
+use diesel::r2d2::ConnectionManager;
use r2d2;
-use r2d2_diesel::ConnectionManager;
use swagger;
@@ -37,8 +36,8 @@ pub struct Server {
impl Api for Server {
fn container_id_get(
&self,
- id: String,
- context: &Context,
+ _id: String,
+ _context: &Context,
) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let c: i64 = container_rev.count().first(&*conn).expect("DB Error");
diff --git a/rust/src/bin/fatcat-iron.rs b/rust/src/bin/fatcat-iron.rs
index e0705787..9f684b92 100644
--- a/rust/src/bin/fatcat-iron.rs
+++ b/rust/src/bin/fatcat-iron.rs
@@ -8,7 +8,6 @@ extern crate fatcat;
extern crate fatcat_api;
extern crate futures;
extern crate iron;
-extern crate iron_diesel_middleware;
extern crate iron_slog;
extern crate swagger;
#[macro_use]
@@ -21,7 +20,6 @@ extern crate slog_term;
use clap::{App, Arg};
use dotenv::dotenv;
use iron::{Chain, Iron};
-use iron_diesel_middleware::{DieselMiddleware, DieselPooledConnection, DieselReqExt};
use iron_slog::{DefaultLogFormatter, LoggerMiddleware};
use slog::{Drain, Logger};
use std::env;
@@ -44,12 +42,6 @@ fn main() {
let logger = Logger::root(drain, o!());
let formatter = DefaultLogFormatter;
- dotenv().ok();
- let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
-
- let diesel_middleware: DieselMiddleware<diesel::pg::PgConnection> =
- DieselMiddleware::new(&database_url).unwrap();
-
let server = fatcat::server().unwrap();
let router = fatcat_api::router(server);
@@ -61,7 +53,6 @@ fn main() {
chain.link_before(AllowAllMiddleware::new("cosmo"));
chain.link_after(fatcat::XClacksOverheadMiddleware);
- //chain.link_before(diesel_middleware);
if matches.is_present("https") {
unimplemented!()
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index b8f2be88..e2b2f892 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -5,7 +5,6 @@ extern crate chrono;
extern crate diesel;
extern crate dotenv;
extern crate futures;
-extern crate iron_diesel_middleware;
#[macro_use]
extern crate hyper;
extern crate swagger;
@@ -13,7 +12,6 @@ extern crate swagger;
extern crate error_chain;
extern crate iron;
extern crate r2d2;
-extern crate r2d2_diesel;
pub mod api_server;
pub mod database_schema;
@@ -25,13 +23,13 @@ mod errors {
pub use self::errors::*;
use diesel::pg::PgConnection;
use diesel::prelude::*;
+use diesel::r2d2::ConnectionManager;
use dotenv::dotenv;
use iron::middleware::AfterMiddleware;
use iron::{Request, Response};
-use r2d2_diesel::ConnectionManager;
use std::env;
-pub type ConnectionPool = r2d2::Pool<r2d2_diesel::ConnectionManager<diesel::pg::PgConnection>>;
+pub type ConnectionPool = r2d2::Pool<ConnectionManager<diesel::pg::PgConnection>>;
pub fn establish_connection() -> PgConnection {
dotenv().ok();