Add the ability to setup custom tempdir on exporter

This commit is contained in:
Andrey Antukh 2023-11-13 18:27:51 +01:00
parent 4af76f9a9a
commit b37acf75ce
2 changed files with 4 additions and 2 deletions

View file

@ -22,6 +22,7 @@
:host "localhost" :host "localhost"
:http-server-port 6061 :http-server-port 6061
:http-server-host "0.0.0.0" :http-server-host "0.0.0.0"
:tempdir "/tmp/penpot-exporter"
:redis-uri "redis://redis/0"}) :redis-uri "redis://redis/0"})
(s/def ::http-server-port ::us/integer) (s/def ::http-server-port ::us/integer)

View file

@ -14,6 +14,7 @@
[app.common.exceptions :as ex] [app.common.exceptions :as ex]
[app.common.logging :as l] [app.common.logging :as l]
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.config :as cf]
[cuerdas.core :as str] [cuerdas.core :as str]
[promesa.core :as p])) [promesa.core :as p]))
@ -22,12 +23,12 @@
(def tempfile-minage (* 1000 60 60 1)) ;; 1h (def tempfile-minage (* 1000 60 60 1)) ;; 1h
(def tmpdir (def tmpdir
(let [path (path/join (os/tmpdir) "penpot")] (let [path (cf/get :tempdir)]
(l/inf :hint "tmptdir setup" :path path)
(when-not (fs/existsSync path) (when-not (fs/existsSync path)
(fs/mkdirSync path #js {:recursive true})) (fs/mkdirSync path #js {:recursive true}))
path)) path))
(defn- schedule-deletion! (defn- schedule-deletion!
[path] [path]
(letfn [(remote-tempfile [] (letfn [(remote-tempfile []