aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/bin/fatcat-iron.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/bin/fatcat-iron.rs')
-rw-r--r--rust/src/bin/fatcat-iron.rs10
1 files changed, 8 insertions, 2 deletions
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<diesel::pg::PgConnection> = DieselMiddleware::new(database_url).unwrap();
+ let diesel_middleware: DieselMiddleware<diesel::pg::PgConnection> = 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!()