ui: serve: Respect site configuration and default options.
* haunt/ui/serve.scm (%default-options): Fix alist. (haunt-serve): Use site config file to determine web server root.
This commit is contained in:
		@@ -27,6 +27,7 @@
 | 
				
			|||||||
  #:use-module (srfi srfi-37)
 | 
					  #:use-module (srfi srfi-37)
 | 
				
			||||||
  #:use-module (ice-9 match)
 | 
					  #:use-module (ice-9 match)
 | 
				
			||||||
  #:use-module (ice-9 format)
 | 
					  #:use-module (ice-9 format)
 | 
				
			||||||
 | 
					  #:use-module (haunt site)
 | 
				
			||||||
  #:use-module (haunt config)
 | 
					  #:use-module (haunt config)
 | 
				
			||||||
  #:use-module (haunt ui)
 | 
					  #:use-module (haunt ui)
 | 
				
			||||||
  #:use-module (haunt serve web-server)
 | 
					  #:use-module (haunt serve web-server)
 | 
				
			||||||
@@ -60,11 +61,13 @@ Start an HTTP server for the current site.~%")
 | 
				
			|||||||
         %common-options))
 | 
					         %common-options))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define %default-options
 | 
					(define %default-options
 | 
				
			||||||
  (cons '((port . 8080))
 | 
					  (cons '(port . 8080)
 | 
				
			||||||
        %default-common-options))
 | 
					        %default-common-options))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (haunt-serve . args)
 | 
					(define (haunt-serve . args)
 | 
				
			||||||
  (let* ((opts (simple-args-fold args %options %default-options))
 | 
					  (let* ((opts (simple-args-fold args %options %default-options))
 | 
				
			||||||
         (port (assoc-ref opts 'port)))
 | 
					         (port (assq-ref opts 'port))
 | 
				
			||||||
    (format #t "serving ~a on port ~d~%" (haunt-output-directory) port)
 | 
					         (site (load-config (assq-ref opts 'config)))
 | 
				
			||||||
    (serve (haunt-output-directory))))
 | 
					         (doc-root (site-build-directory site)))
 | 
				
			||||||
 | 
					    (format #t "serving ~a on port ~d~%" doc-root port)
 | 
				
			||||||
 | 
					    (serve doc-root)))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user