feat(nixcon-demo): Add CLI mode for NixCon demo
Maybe a bit more sane than trying to do a network based setup.
This commit is contained in:
parent
8ffe811d46
commit
161f1b5e85
1 changed files with 13 additions and 2 deletions
|
@ -1,8 +1,19 @@
|
||||||
use std::io;
|
|
||||||
use rouille::Response;
|
use rouille::Response;
|
||||||
|
use std::env;
|
||||||
|
use std::io;
|
||||||
|
use std::process;
|
||||||
|
|
||||||
|
const GREETING: &str = "Haló NixCon!";
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
if let Some(arg) = env::args().last() {
|
||||||
|
if arg == "--cli" {
|
||||||
|
println!("{}", GREETING);
|
||||||
|
process::exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rouille::start_server("0.0.0.0:8080", move |req| {
|
rouille::start_server("0.0.0.0:8080", move |req| {
|
||||||
rouille::log(req, io::stdout(), || Response::text("Haló NixCon!"))
|
rouille::log(req, io::stdout(), || Response::text(GREETING))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue