diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-16 20:15:21 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-16 20:15:21 -0700 |
commit | 3d11c4305c0caf754574de54efbdaa63abeb23e5 (patch) | |
tree | 2adf58936e50b39a301ea154855a82ba55524f9e /rust/src/bin/fatcat-iron.rs | |
parent | 57169bc0b332dfd891f3349a362a57ff71348ddd (diff) | |
download | fatcat-3d11c4305c0caf754574de54efbdaa63abeb23e5.tar.gz fatcat-3d11c4305c0caf754574de54efbdaa63abeb23e5.zip |
rename fatcat-iron to fatcatd
Diffstat (limited to 'rust/src/bin/fatcat-iron.rs')
-rw-r--r-- | rust/src/bin/fatcat-iron.rs | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/rust/src/bin/fatcat-iron.rs b/rust/src/bin/fatcat-iron.rs deleted file mode 100644 index 05a8e1a5..00000000 --- a/rust/src/bin/fatcat-iron.rs +++ /dev/null @@ -1,65 +0,0 @@ -#![allow(missing_docs)] - -extern crate chrono; -extern crate clap; -extern crate diesel; -extern crate dotenv; -extern crate fatcat; -extern crate fatcat_api; -extern crate futures; -extern crate iron; -extern crate iron_slog; -#[macro_use] -extern crate error_chain; -#[macro_use] -extern crate slog; -extern crate slog_async; -extern crate slog_term; - -use clap::{App, Arg}; -use dotenv::dotenv; -use iron::{Chain, Iron}; -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. -fn main() { - let matches = App::new("server") - .arg( - Arg::with_name("https") - .long("https") - .help("Whether to use HTTPS or not"), - ) - .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(); - let logger = Logger::root(drain, o!()); - let formatter = DefaultLogFormatter; - - let server = fatcat::server().unwrap(); - let router = fatcat_api::router(server); - - let mut chain = Chain::new(LoggerMiddleware::new(router, logger, formatter)); - - // Auth stuff unused for now - //chain.link_before(fatcat_api::server::ExtractAuthData); - // add authentication middlewares into the chain here - // for the purpose of this example, pretend we have authenticated a user - //chain.link_before(AllowAllMiddleware::new("cosmo")); - - chain.link_after(fatcat::XClacksOverheadMiddleware); - - if matches.is_present("https") { - unimplemented!() - } else { - // Using HTTP - Iron::new(chain) - .http("localhost:9411") - .expect("Failed to start HTTP server"); - } -} |