aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-data-service/web/server.scm4
-rw-r--r--scripts/guix-data-service.in25
2 files changed, 23 insertions, 6 deletions
diff --git a/guix-data-service/web/server.scm b/guix-data-service/web/server.scm
index 8072dfe..83b01c8 100644
--- a/guix-data-service/web/server.scm
+++ b/guix-data-service/web/server.scm
@@ -43,8 +43,8 @@
(apply values
(run-controller controller request body)))
-(define (start-guix-data-service-web-server port)
+(define (start-guix-data-service-web-server port host)
(run-server (lambda (request body)
(handler request body controller))
- #:addr INADDR_ANY
+ #:host host
#:port port))
diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in
index 5710266..1c57c57 100644
--- a/scripts/guix-data-service.in
+++ b/scripts/guix-data-service.in
@@ -51,12 +51,25 @@
result)))
(option '("update-database") #f #f
(lambda (opt name _ result)
- (alist-cons 'update-database #t result)))))
+ (alist-cons 'update-database #t result)))
+ (option '("port") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'port
+ (string->number arg)
+ (alist-delete 'port result))))
+ (option '("host") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'host
+ arg
+ (alist-delete 'host result))))))
+
(define %default-options
;; Alist of default option values
`((listen-repl . #f)
- (update-database . #f)))
+ (update-database . #f)
+ (port . 8765)
+ (host . "0.0.0.0")))
(define (parse-options args)
(args-fold
@@ -97,6 +110,10 @@
(when pid-file
(call-with-output-file pid-file
(lambda (port)
- (simple-format port "~A\n" (getpid)))))))
+ (simple-format port "~A\n" (getpid))))))
+
+ (simple-format #t "starting the server on port ~A\n"
+ (assq-ref opts 'port))
-(start-guix-data-service-web-server 8765)
+ (start-guix-data-service-web-server (assq-ref opts 'port)
+ (assq-ref opts 'host)))