about summary refs log tree commit diff
path: root/lisp/klatre
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-21T23·36-0400
committerglittershark <grfn@gws.fyi>2020-07-23T22·09+0000
commit974c2e05af96ca2681239e41b1281cdb0d22347f (patch)
treef570de6981edbd2b9f64bb37d8d0e7ef5d75fed3 /lisp/klatre
parent9a85694b8616f2e10f19440f4db9017d44dfae18 (diff)
feat(web/panettone): Read config from env r/1438
Read the port and data directory from environment variables, in
preparation for deploying as a systemd unit to Whitby

Change-Id: I066dced7b7926b6bdc77132d13a4da6c886b20e8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1338
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'lisp/klatre')
-rw-r--r--lisp/klatre/klatre.lisp6
-rw-r--r--lisp/klatre/package.lisp3
2 files changed, 8 insertions, 1 deletions
diff --git a/lisp/klatre/klatre.lisp b/lisp/klatre/klatre.lisp
index b20d1ab5282a..50cc510502e8 100644
--- a/lisp/klatre/klatre.lisp
+++ b/lisp/klatre/klatre.lisp
@@ -88,3 +88,9 @@ separated by SEP."
 
 (comment
  (format-dottime (local-time:now)))
+
+(defun try-parse-integer (str)
+  "Attempt to parse STR as an integer, returning nil if it is invalid."
+  (check-type str string)
+  (handler-case (parse-integer str)
+    (sb-int:simple-parse-error (_) nil)))
diff --git a/lisp/klatre/package.lisp b/lisp/klatre/package.lisp
index b5f574fa16c6..2e6340167909 100644
--- a/lisp/klatre/package.lisp
+++ b/lisp/klatre/package.lisp
@@ -9,4 +9,5 @@
    #:chunk-list #:mapconcat
 
    ;; String handling
-   #:+dottime-format+ #:format-dottime))
+   #:+dottime-format+ #:format-dottime
+   #:try-parse-integer))