about summary refs log tree commit diff
path: root/services
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-10-26T11·50+0200
committerVincent Ambo <tazjin@google.com>2019-10-26T11·50+0200
commit161f1b5e85899446753bce465579aaee366be780 (patch)
tree0578127fd1912b9246eda4d4c3d99868c0e234de /services
parent8ffe811d46a45ee19d863e72ab22417390698d31 (diff)
feat(nixcon-demo): Add CLI mode for NixCon demo
Maybe a bit more sane than trying to do a network based setup.
Diffstat (limited to 'services')
-rw-r--r--services/nixcon-demo/src/main.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/services/nixcon-demo/src/main.rs b/services/nixcon-demo/src/main.rs
index c05124aaa3d8..226fe49ed1a3 100644
--- a/services/nixcon-demo/src/main.rs
+++ b/services/nixcon-demo/src/main.rs
@@ -1,8 +1,19 @@
-use std::io;
 use rouille::Response;
+use std::env;
+use std::io;
+use std::process;
+
+const GREETING: &str = "Haló NixCon!";
 
 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::log(req, io::stdout(), || Response::text("Haló NixCon!"))
+        rouille::log(req, io::stdout(), || Response::text(GREETING))
     })
 }