diff --git a/README.org b/README.org index 1f46f61..c6828aa 100644 --- a/README.org +++ b/README.org @@ -8,7 +8,7 @@ add this to your =project.clj='s =:dependencies=: #+BEGIN_EXAMPLE - [clj-btc "0.1.0"] + [clj-btc "0.1.1"] #+END_EXAMPLE ** [[http://maven.apache.org/][Maven]] @@ -16,7 +16,7 @@ clj-btc clj-btc - 0.1.0 + 0.1.1 #+END_EXAMPLE diff --git a/project.clj b/project.clj index a593873..5741863 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject clj-btc "0.2.0-SNAPSHOT" +(defproject clj-btc "0.1.1" :description "Clojure bindings for the original (C++) Bitcoin Client" :url "https://github.com/aviad/clj-btc" :license {:name "Eclipse Public License" diff --git a/src/clj_btc/config.clj b/src/clj_btc/config.clj index 9219e64..6496d31 100644 --- a/src/clj_btc/config.clj +++ b/src/clj_btc/config.clj @@ -13,7 +13,16 @@ (set! *warn-on-reflection* true) -;;; config file related functions +(defn- read-prop-val + "*Safely* Read a string parsed from the properties file, and parse + it as: Integer, Boolean, String. Otherwise, throw an exception." + [inp] + (try (Long/parseLong inp) + (catch NumberFormatException _ + (if (contains? #{"true" "false"} inp) + (Boolean/parseBoolean inp) + inp)))) + (defn- default-config-file "Return the full path (as a vector of strings) to the default bitcoin.conf file, by OS (default Linux). This is in accordance with @@ -37,7 +46,7 @@ (with-open [reader (jio/reader file-name)] (let [props (java.util.Properties.)] (.load props reader) - (into {} (for [[k v] props] [(keyword k) (read-string v)])))) + (into {} (for [[k v] props] [(keyword k) (read-prop-val v)])))) testnet (and (integer? (:testnet config)) (> (:testnet config) 0))] ;; add default values