Skip to content

Commit b5cf125

Browse files
committed
Fix reading the default configuration
1 parent 0b6e876 commit b5cf125

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/main/clojure/tools/project.clj

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
[tools.process :as process])
1313
(:import
1414
(java.io
15-
File)))
15+
File)
16+
(java.net
17+
URL)))
1618

1719

1820
(defmacro safe
@@ -45,10 +47,19 @@
4547
default (dissoc clauses :default)))
4648

4749

48-
(defn read-edn
49-
[^File file]
50-
(when (and file (.exists file))
51-
(aero/read-config file)))
50+
(defprotocol IReader
51+
(read-edn [this]))
52+
53+
54+
(extend-protocol IReader
55+
File
56+
(read-edn [^File file]
57+
(when (.exists file)
58+
(aero/read-config file)))
59+
60+
URL
61+
(read-edn [^URL url]
62+
(aero/read-config url)))
5263

5364

5465
(def project-filename "project.edn")
@@ -61,7 +72,6 @@
6172
[]
6273
(some->> "io/lazy-cat/tools/project/config.edn"
6374
(io/resource)
64-
(io/file)
6575
(read-edn)))
6676

6777

0 commit comments

Comments
 (0)