safer way of reading the config file
This commit is contained in:
parent
82923bc171
commit
a959779872
|
@ -1,6 +1,7 @@
|
||||||
(ns blarg.util
|
(ns blarg.util
|
||||||
(:require [clojure.string :as str]
|
(:require [clojure.string :as str]
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
|
[clojure.edn :as edn]
|
||||||
[clojure.stacktrace :refer [print-stack-trace]]
|
[clojure.stacktrace :refer [print-stack-trace]]
|
||||||
[markdown.core :as md]
|
[markdown.core :as md]
|
||||||
[noir.io]
|
[noir.io]
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
"loads a file from the resources directory, parses and returns it as clojure"
|
"loads a file from the resources directory, parses and returns it as clojure"
|
||||||
[file]
|
[file]
|
||||||
(with-open [r (PushbackReader. (io/reader (io/resource file)))]
|
(with-open [r (PushbackReader. (io/reader (io/resource file)))]
|
||||||
(read r)))
|
(edn/read r)))
|
||||||
|
|
||||||
(defn load-json
|
(defn load-json
|
||||||
"loads a file from the resources directory, parses it as JSON and returns it
|
"loads a file from the resources directory, parses it as JSON and returns it
|
||||||
|
|
Reference in a new issue