 (ns coffee-table.system
   "Components and their dependency relationships"
   (:require [coffee-table.component.database :refer [new-database]]
-            [coffee-table.config :refer [config]]
+            [coffee-table.config :as ctcfg]
             [com.stuartsierra.component :refer [system-map system-using]]
             [taoensso.timbre :as timbre]
             [coffee-table.config :as config]))

(defn new-system
  "Construct a new system, configured with the given profile"
  [profile]
  (let [config (config profile)]
    (system-using
     (new-system-map config)
     (new-dependency-map))))

(defn new-system-map
  "Create the system. See https://github.com/stuartsierra/component"
  [config]
  (system-map
   :db (new-database {:spec (ctcfg/database-spec config)
                      :migratus (ctcfg/migratus config)})))

(defn new-dependency-map
  "Declare the dependency relationship between components. See https://github.com/stuartsierra/component"
