Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit 5f62a8b

Browse files
committed
Read address to listen on from command line
1 parent 631a85a commit 5f62a8b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/bin/playpen.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ use router::Router;
2222
use unicase::UniCase;
2323
use rustc_serialize::json;
2424

25+
use std::env;
2526
use std::fmt;
26-
use std::path::Path;
2727
use std::io::Read;
28+
use std::path::Path;
2829
use std::process::Command;
2930

3031
#[derive(Clone, Debug)]
@@ -245,7 +246,8 @@ fn main() {
245246
let mut chain = Chain::new(router);
246247
chain.link_after(EnablePostCors);
247248

248-
let addr = ("127.0.0.1", 8080);
249+
let addr = env::args().skip(1).next().unwrap_or("127.0.0.1".to_string());
250+
let addr = (&addr[..], 8080);
249251
println!("listening on {:?}", addr);
250252
Iron::new(chain).http(addr).unwrap();
251253
}

0 commit comments

Comments
 (0)