diff --git a/src/yohoho/core.clj b/src/yohoho/core.clj index 1b50c89..01acc30 100644 --- a/src/yohoho/core.clj +++ b/src/yohoho/core.clj @@ -10,6 +10,11 @@ [next.jdbc.result-set :as rs]) (:gen-class)) +;; Configuration -------------------------------------------------- +(def config + {:db {:dbtype "sqlite" :dbname "yohoho.db"} + :server {:port 3000}}) + ;; Data schema ---------------------------------------------------- ;; Malli schemas for validation @@ -27,7 +32,7 @@ ;; Database stuff ------------------------------------------------- -(def db {:dbtype "sqlite" :dbname "yohoho.db"}) +(def db (:db config)) (defn init-db! "Create database structure if needed" @@ -135,8 +140,8 @@ "HolidayPirates take-home assignement. Goal: build a (very) small REST API that exposes to endpoints." [& args] - (println "Initializing SQLite database...") - (init-db!) - (println "Starting server...") - (http-server/run-jetty app {:port 3000 :join? false}) - (println "Ahoy! Yo-ho-ho API running on port 3000")) + (let [{{port :port} :server} config] + (println "Initializing SQLite database...") + (init-db!) + (println "Ahoy! Yo-ho-ho API starting on port" port) + (http-server/run-jetty app {:port port})))