This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
::s/invalid)))
|
||||
|
||||
(s/def ::d/file
|
||||
(s/conformer #(or (-> % fs/file fs/expand-home fs/absolutize)
|
||||
(s/conformer #(or (-> % fs/expand-home fs/file)
|
||||
::s/invalid)))
|
||||
|
||||
(s/def ::d/executable
|
||||
@@ -44,12 +44,16 @@
|
||||
(and (fs/exists? x) x))
|
||||
(fs/split-paths (System/getenv "XDG_DATA_DIRS"))))
|
||||
|
||||
(defn read-config [f]
|
||||
(->> f aero/read-config (s/conform ::d/config)))
|
||||
(defn read-config [& files]
|
||||
(->> files
|
||||
(filter identity)
|
||||
(map aero/read-config)
|
||||
(apply merge)
|
||||
(s/conform ::d/config)))
|
||||
|
||||
(def default
|
||||
(let [r (->> "net/deertopia/doerg/config.edn"
|
||||
io/resource read-config)]
|
||||
(let [r (-> "net/deertopia/doerg/config.edn"
|
||||
io/resource (read-config (System/getenv "DOERG_CONFIG")))]
|
||||
(if (s/invalid? r)
|
||||
(throw (IllegalArgumentException.
|
||||
"default config is bad!"))
|
||||
|
||||
Reference in New Issue
Block a user