diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-10-12 08:56:10 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-10-12 08:56:10 -0400 |
commit | ef46ae3218923cdc107731cbe2a6e96f20381ccf (patch) | |
tree | 9bd97de4c177bc30e63d94103fcf71b6cd1b174e | |
parent | dfac7ceab4eaf19d87ad6138af8048da59e986b8 (diff) |
Add configurable HTTP server port.
* guix-web/config.scm (guix-web-port): New variable.
* guix-web/render.scm (redirect): Use it.
* guix-web/server.scm (start-guix-web): Ditto.
-rw-r--r-- | guix-web/config.scm | 5 | ||||
-rw-r--r-- | guix-web/render.scm | 2 | ||||
-rw-r--r-- | guix-web/server.scm | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/guix-web/config.scm b/guix-web/config.scm index 4c2220d..5de3dea 100644 --- a/guix-web/config.scm +++ b/guix-web/config.scm @@ -17,7 +17,8 @@ (define-module (guix-web config) #:use-module (ice-9 match) - #:use-module (guix-web server) - #:export (guix-web-asset-dir)) + #:export (guix-web-asset-dir + guix-web-port)) (define guix-web-asset-dir (getcwd)) +(define guix-web-port 8080) diff --git a/guix-web/render.scm b/guix-web/render.scm index 024bcf7..835585f 100644 --- a/guix-web/render.scm +++ b/guix-web/render.scm @@ -20,6 +20,7 @@ #:use-module (web uri) #:use-module (sxml simple) #:use-module (json) + #:use-module (guix-web config) #:export (render-html render-json not-found @@ -53,6 +54,7 @@ (define (redirect path) (let ((uri (build-uri 'http #:host "localhost" + #:port guix-web-port #:path (string-append "/" (encode-and-join-uri-path path))))) (list (build-response diff --git a/guix-web/server.scm b/guix-web/server.scm index af9f9dc..25f92f5 100644 --- a/guix-web/server.scm +++ b/guix-web/server.scm @@ -64,5 +64,5 @@ (run-server (lambda args (apply handler args)) 'http `(#:addr ,INADDR_ANY - #:port 8080) + #:port ,guix-web-port) controller)) |