summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac <arunisaac@systemreboot.net>2022-01-03 01:13:23 +0530
committerRicardo Wurmus <rekado@elephly.net>2022-01-07 16:42:16 +0100
commit35a11293225d27d1d1f9c5e6e13def2b232761b5 (patch)
treeb8c09fa7e79c9a4c3e551182e4823a3a1e0d6a8e
parent6d29e3bf601801b734769bf6ae1b11f84f94ee8a (diff)
web: Parameterize web server listen address.
* mumi/web/server.scm (start-mumi-web-server): Accept web server listen address as argument. * scripts/mumi.in: Pass 0.0.0.0 as web server listen address.
-rw-r--r--mumi/web/server.scm8
-rw-r--r--scripts/mumi.in2
2 files changed, 5 insertions, 5 deletions
diff --git a/mumi/web/server.scm b/mumi/web/server.scm
index 5fb54eb..db7662a 100644
--- a/mumi/web/server.scm
+++ b/mumi/web/server.scm
@@ -35,10 +35,10 @@
(cons (request-method request)
(request-path-components request)))))
-(define (start-mumi-web-server port)
+(define (start-mumi-web-server address port)
(format (current-error-port)
- "Mumi web server listening on http://0.0.0.0:~a/~%"
- port)
+ "Mumi web server listening on http://~a:~a/~%"
+ address port)
(run-server handler
- #:addr INADDR_ANY
+ #:addr (inet-pton AF_INET address)
#:port port))
diff --git a/scripts/mumi.in b/scripts/mumi.in
index bd13b1b..5ec33cc 100644
--- a/scripts/mumi.in
+++ b/scripts/mumi.in
@@ -140,5 +140,5 @@
"REPL server listening on port ~a~%"
repl-port)
(spawn-server (make-tcp-server-socket #:port repl-port))))
- (start-mumi-web-server 1234))))
+ (start-mumi-web-server "0.0.0.0" 1234))))
(_ (show-mumi-usage)))