summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-10-13 21:34:44 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-10-13 21:34:44 -0400
commit6e919c73b19e20c837b9f54319ca4c1868392a1f (patch)
tree3ea80513bb5ca11f13d88dabc2ce92dc43a666bd
parentc089745776220fa42a43181ecd9c25abc1400c88 (diff)
Allow hostname customization.
* guix-web/config.scm (guix-web-host): New variable. * guix-web/render.scm (render-static-asset, redirect): Use 'guix-web-host'.
-rw-r--r--guix-web/config.scm2
-rw-r--r--guix-web/render.scm4
2 files changed, 4 insertions, 2 deletions
diff --git a/guix-web/config.scm b/guix-web/config.scm
index 5de3dea..8094d83 100644
--- a/guix-web/config.scm
+++ b/guix-web/config.scm
@@ -18,7 +18,9 @@
(define-module (guix-web config)
#:use-module (ice-9 match)
#:export (guix-web-asset-dir
+ guix-web-host
guix-web-port))
(define guix-web-asset-dir (getcwd))
+(define guix-web-host "localhost")
(define guix-web-port 8080)
diff --git a/guix-web/render.scm b/guix-web/render.scm
index 1d88831..375c81d 100644
--- a/guix-web/render.scm
+++ b/guix-web/render.scm
@@ -44,7 +44,7 @@
(file-extension file-name))))
(call-with-input-file file-name get-bytevector-all))
(not-found (build-uri 'http
- #:host "localhost"
+ #:host guix-web-host
#:port guix-web-port
#:path (string-join path "/" 'prefix))))))
@@ -73,7 +73,7 @@
(define (redirect path)
(let ((uri (build-uri 'http
- #:host "localhost"
+ #:host guix-web-host
#:port guix-web-port
#:path (string-append
"/" (encode-and-join-uri-path path)))))