Skip to content

Commit 9e1fcbe

Browse files
committed
dev: cljdoc-preview tweaks
For security reasons, docker is no longer so happy to mount volumes from `/tmp`, so move our cljdoc db dir to `~/.cljdoc-preview`. Also minor babashka modernizations.
1 parent 2179920 commit 9e1fcbe

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

script/cljdoc_preview.clj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bb
22

33
(ns cljdoc-preview
4-
(:require [babashka.curl :as curl]
5-
[babashka.fs :as fs]
4+
(:require [babashka.fs :as fs]
5+
[babashka.http-client :as http]
66
[clojure.java.browse :as browse]
77
[clojure.string :as string]
88
[helper.git :as git]
@@ -28,7 +28,7 @@
2828
;; constants
2929
;;
3030

31-
(def cljdoc-root-temp-dir "/tmp/cljdoc-preview")
31+
(def cljdoc-root-temp-dir "./.cljdoc-preview")
3232
(def cljdoc-db-dir (str cljdoc-root-temp-dir "/db"))
3333
(def cljdoc-container {:name "cljdoc-server"
3434
:image "cljdoc/cljdoc"
@@ -140,7 +140,7 @@
140140
(let [url (str "http://localhost:" (:port container))]
141141
(loop []
142142
(if-not (try
143-
(curl/get url)
143+
(http/get url)
144144
url
145145
(catch Exception _e
146146
(Thread/sleep 4000)))
@@ -193,11 +193,10 @@
193193

194194
(defn view-in-browser [url]
195195
(status/line :head "opening %s in browser" url)
196-
(when (not= 200 (:status (curl/get url {:throw false})))
196+
(when (not= 200 (:status (http/get url {:throw false})))
197197
(status/die 1 "Could not reach:\n%s\nDid you run the ingest command yet?" url))
198198
(browse/browse-url url))
199199

200-
201200
;;
202201
;; main
203202
;;

0 commit comments

Comments
 (0)