Skip to content

Commit

Permalink
Properly handle unknown load-config source
Browse files Browse the repository at this point in the history
  • Loading branch information
imrekoszo committed Apr 13, 2022
1 parent f21454b commit 3c8484c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/kaocha/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@

(extend-protocol ConfigSource

nil ;; handle nil source case
(read-config [_ _]
(default-config))
Object ;; keep existing default behaviour
(read-config [path opts]
(read-config (io/file path) opts))

File
(read-config [^File file opts]
Expand All @@ -127,10 +127,6 @@
;; and will only revert to a file if not
(read-config-source file opts)))

String ;; keep existing default behaviour
(read-config [path opts]
(read-config (io/file path) opts))

URL ;; resource
(read-config [resource opts]
(when resource
Expand All @@ -148,7 +144,7 @@
([source opts]
(if-some [config (read-config source opts)]
config
(read-config nil opts))))
(default-config))))

(defn apply-cli-opts [config options]
(cond-> config
Expand Down

0 comments on commit 3c8484c

Please sign in to comment.