Read environment variable in example server
This commit is contained in:
parent
2c8fbee4c9
commit
f4a3240cc8
1 changed files with 4 additions and 2 deletions
|
@ -4,6 +4,8 @@ extern crate logger;
|
|||
extern crate rustc_serialize;
|
||||
#[macro_use] extern crate juniper;
|
||||
|
||||
use std::env;
|
||||
|
||||
use mount::Mount;
|
||||
use logger::Logger;
|
||||
use iron::prelude::*;
|
||||
|
@ -29,9 +31,9 @@ fn main() {
|
|||
chain.link_before(logger_before);
|
||||
chain.link_after(logger_after);
|
||||
|
||||
let host = "localhost:8080";
|
||||
let host = env::var("LISTEN").unwrap_or("0.0.0.0:8080".to_owned());
|
||||
println!("GraphQL server started on {}", host);
|
||||
Iron::new(chain).http(host).unwrap();
|
||||
Iron::new(chain).http(host.as_str()).unwrap();
|
||||
}
|
||||
|
||||
struct Query {}
|
||||
|
|
Loading…
Reference in a new issue