aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-12-24 02:15:17 +0100
committerMathieu Lirzin <mthl@gnu.org>2016-12-28 18:49:21 +0100
commit8a782b3e84059cd1068500ccf327d6b9c3d6db09 (patch)
tree229dd5fab398ab5d2029d5a83b08bd406eac7040
parentb59b8e55675ddd83187423a2877ad481f884aa6f (diff)
downloadcuirass-8a782b3e84059cd1068500ccf327d6b9c3d6db09.tar
cuirass-8a782b3e84059cd1068500ccf327d6b9c3d6db09.tar.gz
cuirass: Add "--port" command line option.
* bin/cuirass.in (%options): Add "--port" and "-p" command line options. (show-help): Adapt. (main): Set default to 8080. Call 'run-cuirass-server' with this. * src/cuirass/http.scm (run-cuirass-server): Display the port number. * doc/cuirass.texi (Invocation): Document new option.
-rw-r--r--bin/cuirass.in5
-rw-r--r--doc/cuirass.texi5
-rw-r--r--src/cuirass/http.scm1
3 files changed, 10 insertions, 1 deletions
diff --git a/bin/cuirass.in b/bin/cuirass.in
index a1260ec..b41a713 100644
--- a/bin/cuirass.in
+++ b/bin/cuirass.in
@@ -37,6 +37,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
-S --specifications=SPECFILE
Add specifications from SPECFILE to database.
-D --database=DB Use DB to store build results.
+ -p --port=NUM Port of the HTTP server.
-I, --interval=N Wait N seconds between each poll
--use-substitutes Allow usage of pre-built substitutes
-V, --version Display version
@@ -49,6 +50,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(cache-directory (value #t))
(specifications (single-char #\S) (value #t))
(database (single-char #\D) (value #t))
+ (port (single-char #\p) (value #t))
(interval (single-char #\I) (value #t))
(use-substitutes (value #f))
(version (single-char #\V) (value #f))
@@ -76,6 +78,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(exit 0))
(else
(let ((one-shot? (option-ref opts 'one-shot #f))
+ (port (string->number (option-ref opts 'port "8080")))
(interval (string->number (option-ref opts 'interval "10")))
(specfile (option-ref opts 'specifications #f)))
(with-database db
@@ -94,4 +97,4 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(while #t
(process-specs db (db-get-specifications db))
(sleep interval))))
- (run-cuirass-server db))))))))))
+ (run-cuirass-server db #:port port))))))))))
diff --git a/doc/cuirass.texi b/doc/cuirass.texi
index 8233f6e..d12ddea 100644
--- a/doc/cuirass.texi
+++ b/doc/cuirass.texi
@@ -169,6 +169,11 @@ build results. Since @code{cuirass} uses SQLite as a database engine,
@var{database} must be a file name. If the file doesn't exist, it will
be created.
+@item --port=@var{num}
+@itemx -p @var{num}
+Make the HTTP interface listen on port @var{num}. Use port 8080 by
+default.
+
@item --interval=@var{n}
@itemx -I @var{n}
Wait @var{n} seconds between each poll.
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 7fabd61..33cd37b 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -71,6 +71,7 @@
(uri->string (request-uri request)))))))
(define* (run-cuirass-server db #:key (port 8080))
+ (format (current-error-port) "listening on port ~A~%" port)
(run-server url-handler
'http ;server implementation
`(#:port ,port) ;implementation parameters