From 3d11c4305c0caf754574de54efbdaa63abeb23e5 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 16 May 2018 20:15:21 -0700 Subject: rename fatcat-iron to fatcatd --- rust/src/bin/fatcat-iron.rs | 65 --------------------------------------------- rust/src/bin/fatcatd.rs | 65 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 rust/src/bin/fatcat-iron.rs create mode 100644 rust/src/bin/fatcatd.rs (limited to 'rust/src') 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"); - } -} diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs new file mode 100644 index 00000000..05a8e1a5 --- /dev/null +++ b/rust/src/bin/fatcatd.rs @@ -0,0 +1,65 @@ +#![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"); + } +} -- cgit v1.2.3