summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2021-05-18 07:31:44 -0500
committerColin Okay <okay@toyful.space>2021-05-18 07:31:44 -0500
commitd17133f047ee83c0e95952284810dfca54cfed84 (patch)
tree7b2d457f41b16cc858d5db953b5a8fc7d232fc21
parent2d508a8890157f69a60db9905ff167612614c8a5 (diff)
added *host* dynamic variable
-rw-r--r--flexo.lisp10
-rw-r--r--package.lisp1
2 files changed, 9 insertions, 2 deletions
diff --git a/flexo.lisp b/flexo.lisp
index e40b4fb..5228c79 100644
--- a/flexo.lisp
+++ b/flexo.lisp
@@ -18,6 +18,10 @@
"Dynamic hash-table, bound before building a site. A collection of
artifacts, indexed by the url path of the artifact.")
+(defvar *host* nil
+ "Dynamic string, bound before building a site, that holds the url of
+ the host, including the transfer protocol (https/http/etc).")
+
;;; HACKING ON A SITE
(defgeneric content-equivlanet-p (a b)
@@ -118,6 +122,7 @@ artifact tables have changed."
(bt:make-thread
(lambda ()
(let ((*auto-refresh-key* (when auto-refresh (make-auto-refresh-key)))
+ (*host* (format nil "http://localhost:~a" port))
(the-site (run-recipe recipe)))
(format t "Start Hacking on localhost port ~a~%" port)
(loop :while (hunchentoot:started-p *development-acceptor*)
@@ -431,9 +436,10 @@ artifact tables have changed."
(loop for artifact being the hash-value of site
do (publish artifact location)))
-(defun build-and-publish (recipe location)
+(defun build-and-publish (recipe location host)
"RECIPE is a function of zero arguments that builds a site in a
fresh context and, if successful, publishes that site to
LOCATION. Calls PUBLISH under the hood on each ARTIFACT created in
the recipe."
- (publish-site (run-recipe recipe) location))
+ (let ((*host* host))
+ (publish-site (run-recipe recipe) location)))
diff --git a/package.lisp b/package.lisp
index 80441b7..e480776 100644
--- a/package.lisp
+++ b/package.lisp
@@ -6,6 +6,7 @@
#:with-html
#:with-html-string)
(:export
+ #:*host*
#:add-file
#:add-files-matching
#:artifact