Add config loading from custom file, default file and internal config
This commit is contained in:
parent
9bb30b9863
commit
e230e33a55
1 changed files with 9 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue