mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 01:47:17 +02:00
🐛 Fix issues on exporter configuration validation
This commit is contained in:
parent
a91b2f1133
commit
6c8ea5d899
1 changed files with 20 additions and 17 deletions
|
@ -24,7 +24,9 @@
|
||||||
:tempdir "/tmp/penpot-exporter"
|
:tempdir "/tmp/penpot-exporter"
|
||||||
:redis-uri "redis://redis/0"})
|
:redis-uri "redis://redis/0"})
|
||||||
|
|
||||||
(def ^:private schema:config
|
(def ^:private
|
||||||
|
schema:config
|
||||||
|
(sm/define
|
||||||
[:map {:title "config"}
|
[:map {:title "config"}
|
||||||
[:public-uri {:optional true} ::sm/uri]
|
[:public-uri {:optional true} ::sm/uri]
|
||||||
[:host {:optional true} :string]
|
[:host {:optional true} :string]
|
||||||
|
@ -33,7 +35,7 @@
|
||||||
[:redis-uri {:optional true} :string]
|
[:redis-uri {:optional true} :string]
|
||||||
[:tempdir {:optional true} :string]
|
[:tempdir {:optional true} :string]
|
||||||
[:browser-pool-max {:optional true} :int]
|
[:browser-pool-max {:optional true} :int]
|
||||||
[:browser-pool-min {:optional true} :int]])
|
[:browser-pool-min {:optional true} :int]]))
|
||||||
|
|
||||||
(defn- parse-flags
|
(defn- parse-flags
|
||||||
[config]
|
[config]
|
||||||
|
@ -58,14 +60,15 @@
|
||||||
[]
|
[]
|
||||||
(let [env (read-env "penpot")
|
(let [env (read-env "penpot")
|
||||||
env (d/without-nils env)
|
env (d/without-nils env)
|
||||||
data (merge defaults env)
|
data (merge defaults env)]
|
||||||
data (sm/decode schema:config data sm/default-transformer)]
|
|
||||||
|
|
||||||
(when-not (sm/validate schema:config data)
|
(try
|
||||||
(println (sm/humanize-data schema:config data))
|
(sm/conform! schema:config data)
|
||||||
(process/exit -1))
|
(catch :default cause
|
||||||
|
(if-let [explain (some->> cause ex-data ::sm/explain)]
|
||||||
data))
|
(println (sm/humanize-explain explain))
|
||||||
|
(js/console.error cause))
|
||||||
|
(process/exit -1)))))
|
||||||
|
|
||||||
(def config
|
(def config
|
||||||
(prepare-config))
|
(prepare-config))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue