diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-15 14:48:41 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-15 14:48:41 -0700 |
commit | e35b10434aa4ceb2708610f13fe078e977496ce5 (patch) | |
tree | cb4983cf8a6b64a6d512ce9f3e9c968cce2e5a2b /rust/src/bin/fatcat-iron.rs | |
parent | fe77445bd16db003e03b5c44fa02c65b78e6fa02 (diff) | |
download | fatcat-e35b10434aa4ceb2708610f13fe078e977496ce5.tar.gz fatcat-e35b10434aa4ceb2708610f13fe078e977496ce5.zip |
fmt
Diffstat (limited to 'rust/src/bin/fatcat-iron.rs')
-rw-r--r-- | rust/src/bin/fatcat-iron.rs | 31 |
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 |