aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-06-13 19:06:53 +0100
committerChristopher Baines <mail@cbaines.net>2019-06-13 19:06:53 +0100
commit5323f24133c9cf5f50222f085eeb6c6772852e56 (patch)
tree1bd43b825c9bb2fbfa3e8dbac2a299a0ea9c68ac /scripts
parentbd292d6f570ef76fd2bcd10050915e2c8f811078 (diff)
downloaddata-service-5323f24133c9cf5f50222f085eeb6c6772852e56.tar
data-service-5323f24133c9cf5f50222f085eeb6c6772852e56.tar.gz
Add --port and --host as options to the guix-data-service
Diffstat (limited to 'scripts')
-rw-r--r--scripts/guix-data-service.in25
1 files changed, 21 insertions, 4 deletions
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)))