diff --git a/src/rss_thread_watch/core.clj b/src/rss_thread_watch/core.clj index f564bb4..9b25b22 100644 --- a/src/rss_thread_watch/core.clj +++ b/src/rss_thread_watch/core.clj @@ -18,7 +18,8 @@ [ring.adapter.jetty :as jetty] [ring.middleware.params :as rp] [rss-thread-watch.watcher :as watcher] - [rss-thread-watch.feed-generator :as feed]) + [rss-thread-watch.feed-generator :as feed] + [rss-thread-watch.utils :as u]) (:gen-class)) ;; Internal default config @@ -62,17 +63,18 @@ lastly uses default internal" ;; args do not include path to executable so first arg ;; should be config file - [cmd-args]) + [cmd-args] + (let [file-to-try (u/nil?-else (first cmd-args) + "./config.edn")] + (u/when-else2 (load-config file-to-try) + (println "WARN: Using default internal config because suggessted " file-to-try " not found.") + CONFIG-DEFAULT))) ;; Todo: Add option to write default config to stdout -;; Todo: Discover config file if not arguments else -;; ./config.edn if not found spit error about -;; using default (defn -main "Entry point, starts webserver" [& args] - ;; Parse and validate config - ;; Think of a way to start repeated download for every catalog efficiently + ;; Todo: Think of a way to start repeated download for every catalog efficiently (let [config (get-some-config args)]) (println args) (System/exit 0)