Skip to content

Commit 68136de

Browse files
authored
dev: cljdoc-preview tweaks [skip ci] (#292)
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 6e3cda0 commit 68136de

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
/fiddle.clj
1616
/faddle.clj
1717
/fiddle/
18+
/.cljdoc-preview

script/cljdoc_preview.clj

Lines changed: 5 additions & 5 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
[build-shared]
77
[clojure.java.browse :as browse]
88
[clojure.string :as string]
@@ -14,7 +14,7 @@
1414
;; constants
1515
;;
1616

17-
(def cljdoc-root-temp-dir "/tmp/cljdoc-preview")
17+
(def cljdoc-root-temp-dir "./.cljdoc-preview")
1818
(def cljdoc-db-dir (str cljdoc-root-temp-dir "/db"))
1919
(def cljdoc-container {:name "cljdoc-server"
2020
:image "cljdoc/cljdoc"
@@ -129,7 +129,7 @@
129129
(let [url (str "http://localhost:" (:port container))]
130130
(loop []
131131
(if-not (try
132-
(curl/get url)
132+
(http/get url)
133133
url
134134
(catch Exception _e
135135
(Thread/sleep 4000)))
@@ -182,7 +182,7 @@
182182

183183
(defn view-in-browser [url]
184184
(status/line :head "opening %s in browser" url)
185-
(when (not= 200 (:status (curl/get url {:throw false})))
185+
(when (not= 200 (:status (http/get url {:throw false})))
186186
(status/die 1 "Could not reach:\n%s\nDid you run the ingest command yet?" url))
187187
(browse/browse-url url))
188188

0 commit comments

Comments
 (0)