aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/bin')
-rw-r--r--rust/src/bin/fatcat-iron.rs31
1 files changed, 16 insertions, 15 deletions
diff --git a/rust/src/bin/fatcat-iron.rs b/rust/src/bin/fatcat-iron.rs
index d89a9c53..e0705787 100644
--- a/rust/src/bin/fatcat-iron.rs
+++ b/rust/src/bin/fatcat-iron.rs
@@ -2,28 +2,30 @@
extern crate chrono;
extern crate clap;
+extern crate diesel;
+extern crate dotenv;
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_diesel_middleware;
extern crate iron_slog;
extern crate swagger;
-#[macro_use] extern crate error_chain;
-#[macro_use] extern crate slog;
-extern crate slog_term;
+#[macro_use]
+extern crate error_chain;
+#[macro_use]
+extern crate slog;
extern crate slog_async;
+extern crate slog_term;
-use slog::{Drain, Logger};
-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::{Chain, Iron};
use iron_diesel_middleware::{DieselMiddleware, DieselPooledConnection, DieselReqExt};
+use iron_slog::{DefaultLogFormatter, LoggerMiddleware};
+use slog::{Drain, Logger};
+use std::env;
+use swagger::auth::AllowAllMiddleware;
/// Create custom server, wire it to the autogenerated router,
/// and pass it to the web server.
@@ -36,7 +38,6 @@ fn main() {
)
.get_matches();
-
let decorator = slog_term::TermDecorator::new().build();
let drain = slog_term::CompactFormat::new(decorator).build().fuse();
let drain = slog_async::Async::new(drain).build().fuse();
@@ -46,13 +47,13 @@ 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);
- let mut chain = Chain::new(
- LoggerMiddleware::new(router, logger, formatter ));
+ let mut chain = Chain::new(LoggerMiddleware::new(router, logger, formatter));
chain.link_before(fatcat_api::server::ExtractAuthData);
// add authentication middlewares into the chain here