added proper configuration using aero

This commit is contained in:
didier amyot committed 2018-06-25 10:35:45 -04:00
1 parent c823775c0c
commit d2c554dcc8
8 files changed
+43 -14

No files matched your search

+11 -6
View File
@@ -1,10 +1,15 @@
(ns book.core
(:require [book.cli]
[book.web])
(:require [book.cli.core]
[book.rest.core]
[aero.core :refer (read-config)])
(:gen-class))
(def apps {:webserver book.rest.core/-main})
(defn -main [& argv]
(case (first argv)
"web" (apply book.web/-main (rest argv))
"cli" (apply book.cli/-main (rest argv))
(println "First argument must be web or cli")))
(let [config (-> "config.edn" clojure.java.io/resource read-config)
target (-> argv first keyword)
target-fn (get apps target)]
(if target-fn
(apply target-fn [config])
(println "target" target "not found"))))