0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 17:18:21 -05:00

Add better error reporting on config validation.

This commit is contained in:
Andrey Antukh 2021-05-14 12:34:10 +02:00 committed by Alonso Torres
parent 087f2aee09
commit a3e464aea3

View file

@ -9,6 +9,7 @@
(:refer-clojure :exclude [get]) (:refer-clojure :exclude [get])
(:require (:require
[app.common.data :as d] [app.common.data :as d]
[app.common.exceptions :as ex]
[app.common.spec :as us] [app.common.spec :as us]
[app.common.version :as v] [app.common.version :as v]
[app.util.time :as dt] [app.util.time :as dt]
@ -46,8 +47,7 @@
:database-username "penpot" :database-username "penpot"
:database-password "penpot" :database-password "penpot"
:default-blob-version 1 :default-blob-version 3
:loggers-zmq-uri "tcp://localhost:45556" :loggers-zmq-uri "tcp://localhost:45556"
:asserts-enabled false :asserts-enabled false
@ -273,9 +273,17 @@
(defn- read-config (defn- read-config
[] []
(->> (read-env "penpot") (try
(merge defaults) (->> (read-env "penpot")
(us/conform ::config))) (merge defaults)
(us/conform ::config))
(catch Throwable e
(when (ex/ex-info? e)
(println ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;")
(println "Error on validating configuration:")
(println (:explain (ex-data e))
(println ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;")))
(throw e))))
(def version (v/parse (or (some-> (io/resource "version.txt") (def version (v/parse (or (some-> (io/resource "version.txt")
(slurp) (slurp)