summaryrefslogtreecommitdiffstats
path: root/rust/src/bin
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-15 00:35:52 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-15 00:35:52 -0700
commit28978964a77e853031874230c2415b1b835e93fc (patch)
tree8080670ee5f60aee8ba058a5babf80eaca7b4ded /rust/src/bin
parent33a4cce0b97832f5f0301b318a0a50073ce6b615 (diff)
downloadfatcat-28978964a77e853031874230c2415b1b835e93fc.tar.gz
fatcat-28978964a77e853031874230c2415b1b835e93fc.zip
fmt and cleanup
Diffstat (limited to 'rust/src/bin')
-rw-r--r--rust/src/bin/fatcat-iron.rs50
1 files changed, 13 insertions, 37 deletions
diff --git a/rust/src/bin/fatcat-iron.rs b/rust/src/bin/fatcat-iron.rs
index 8c87f55f..4c168981 100644
--- a/rust/src/bin/fatcat-iron.rs
+++ b/rust/src/bin/fatcat-iron.rs
@@ -1,52 +1,28 @@
-//! Main binary entry point for fatcat implementation.
-
#![allow(missing_docs)]
-// Imports required by this file.
+extern crate chrono;
+extern crate clap;
extern crate fatcat;
extern crate fatcat_api;
-extern crate swagger;
-extern crate iron;
-//extern crate hyper_openssl;
-extern crate clap;
-
-// Imports required by server library.
-// extern crate fatcat;
-// extern crate swagger;
extern crate futures;
-extern crate chrono;
+extern crate iron;
+extern crate swagger;
#[macro_use]
extern crate error_chain;
-//use hyper_openssl::OpensslServer;
-//use hyper_openssl::openssl::x509::X509_FILETYPE_PEM;
-//use hyper_openssl::openssl::ssl::{SslAcceptorBuilder, SslMethod};
-//use hyper_openssl::openssl::error::ErrorStack;
use clap::{App, Arg};
-use iron::{Iron, Chain};
+use iron::{Chain, Iron};
use swagger::auth::AllowAllMiddleware;
-/*
-/// Builds an SSL implementation for Simple HTTPS from some hard-coded file names
-fn ssl() -> Result<OpensslServer, ErrorStack> {
- let mut ssl = SslAcceptorBuilder::mozilla_intermediate_raw(SslMethod::tls())?;
-
- // Server authentication
- ssl.set_private_key_file("examples/server-key.pem", X509_FILETYPE_PEM)?;
- ssl.set_certificate_chain_file("examples/server-chain.pem")?;
- ssl.check_private_key()?;
-
- Ok(OpensslServer::from(ssl.build()))
-}
-*/
-
/// 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"))
+ .arg(
+ Arg::with_name("https")
+ .long("https")
+ .help("Whether to use HTTPS or not"),
+ )
.get_matches();
let server = fatcat::server().unwrap();
@@ -60,10 +36,10 @@ fn main() {
if matches.is_present("https") {
unimplemented!()
- // Using Simple HTTPS
- //Iron::new(chain).https("localhost:8080", ssl().expect("Failed to load SSL keys")).expect("Failed to start HTTPS server");
} else {
// Using HTTP
- Iron::new(chain).http("localhost:8080").expect("Failed to start HTTP server");
+ Iron::new(chain)
+ .http("localhost:8080")
+ .expect("Failed to start HTTP server");
}
}