diff --git a/src/main/lemondronor/circlebot.cljs b/src/main/lemondronor/circlebot.cljs index 5836c3b..dbb21c3 100644 --- a/src/main/lemondronor/circlebot.cljs +++ b/src/main/lemondronor/circlebot.cljs @@ -481,7 +481,7 @@ (defn build-config [config cli-config secrets] - (util/deep-merge default-config config cli-config secrets)) + (util/deep-merge default-config oconfig cli-config secrets)) (defn main [& args] (-> commander @@ -501,9 +501,6 @@ cli-config (build-config-from-commander commander) secrets (util/read-config (.-secrets commander)) config (build-config base-config cli-config secrets) - _1 (pprint/pprint base-config) - _2 (pprint/pprint cli-config) - _3 (pprint/pprint config) db (read-history-db (:history-db-path config)) data (get-adsbexchange-live-data {:url (get-in config [:adsbx :url]) diff --git a/src/main/lemondronor/circlebot/util.cljs b/src/main/lemondronor/circlebot/util.cljs index 6837860..3cf6ba4 100644 --- a/src/main/lemondronor/circlebot/util.cljs +++ b/src/main/lemondronor/circlebot/util.cljs @@ -30,8 +30,9 @@ (defn read-config [path] (log-verbose "Reading config file %s" path) (p/let [data (read-file path {:encoding "utf-8"})] - (-> (yaml/safeLoad data) - (js->clj :keywordize-keys true)))) + (let [config (-> (yaml/safeLoad data) + (js->clj :keywordize-keys true))] + (or config {})))) ;; Fetches a URL. Returns a promise that resolves to the body of the diff --git a/src/test/lemondronor/circlebot/util_test.cljs b/src/test/lemondronor/circlebot/util_test.cljs index c399578..b60fb8b 100644 --- a/src/test/lemondronor/circlebot/util_test.cljs +++ b/src/test/lemondronor/circlebot/util_test.cljs @@ -7,4 +7,9 @@ {:adsbx {:url "http://bar"}} {:adsbx {:url "http://foo"}} {:adsbx {:secret "123"}}) - {:adsbx {:url "http://foo", :secret "123"}}))) + {:adsbx {:url "http://foo", :secret "123"}})) + (is (= (util/deep-merge + {:adsbx {:url "http://bar"}} + {} + {:adsbx {:secret "123"}}) + {:adsbx {:url "http://bar", :secret "123"}}))) diff --git a/src/test/lemondronor/circlebot_test.cljs b/src/test/lemondronor/circlebot_test.cljs index 328b600..49da616 100644 --- a/src/test/lemondronor/circlebot_test.cljs +++ b/src/test/lemondronor/circlebot_test.cljs @@ -37,7 +37,7 @@ (deftest prune-history (let [hist [{:time 0 :id 0} {:time 1000000 :id 1} {:time 2000000 :id 2}]] - (is (= (circlebot/prune-history hist 2500000) + (is (= (circlebot/prune-history hist 2500000 circlebot/default-config) [{:time 2000000 :id 2}]))))