summaryrefslogtreecommitdiff
path: root/scripts/mumi.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mumi.in')
-rw-r--r--scripts/mumi.in25
1 files changed, 22 insertions, 3 deletions
diff --git a/scripts/mumi.in b/scripts/mumi.in
index 5ec33cc..9c997a2 100644
--- a/scripts/mumi.in
+++ b/scripts/mumi.in
@@ -67,7 +67,23 @@
(define %options
;; Specifications of the command-line options
- (list (option '("listen-repl") #f #t
+ (list (option '("address") #t #f
+ (lambda (opt name arg result)
+ (catch #t
+ (lambda ()
+ (inet-pton AF_INET arg))
+ (lambda _
+ (error "invalid web server address" arg)))
+ (alist-cons 'address arg
+ (alist-delete 'address result))))
+ (option '("port") #t #f
+ (lambda (opt name arg result)
+ (let ((port (string->number arg)))
+ (if port
+ (alist-cons 'port port
+ (alist-delete 'port result))
+ (error "invalid web server port" arg)))))
+ (option '("listen-repl") #f #t
(lambda (opt name arg result)
(let ((port (cond (arg => string->number)
(else %default-repl-server-port))))
@@ -104,7 +120,7 @@
(define (show-mumi-usage)
(format (current-error-port)
"
- `mumi web [--listen-repl[=port]] [--disable-mailer]':
+ `mumi web [--address=address] [--port=port] [--listen-repl[=port]] [--disable-mailer]':
start the application web server.
`mumi mailer --sender=SENDER --smtp=SMTP:
@@ -140,5 +156,8 @@
"REPL server listening on port ~a~%"
repl-port)
(spawn-server (make-tcp-server-socket #:port repl-port))))
- (start-mumi-web-server "0.0.0.0" 1234))))
+ (start-mumi-web-server (or (assoc-ref opts 'address)
+ "0.0.0.0")
+ (or (assoc-ref opts 'port)
+ 1234)))))
(_ (show-mumi-usage)))