duct

bocaj 2019-09-09T23:37:11.054900Z

I'm trying to shift my thinking from an app shared atom

(:db @app)
to using the
:duct.module/sql
key. The smallest step to refactor my app to at least "compile" is to switch out a function
state/app-db
that used to return the db spec
(:db @app)
. How can I evaluate the ig/ref for key :duct.module/sql to get back the db spec? so far I have
(ns watchdude.state
  (:require [duct.database.sql :as sql]
            [integrant.core :as ig]
            [taoensso.timbre :as log])
  (:import (duct.database.sql Boundary)))

(defmethod ig/init-key ::app-db [_ {:keys [db]}]
  (log/info db)
  db)

;; (defn app-db [] (:db @app)
(defn app-db "get db spec out of duct.database.sql"
  []
  ,,,)
with config.edn
:duct.module/sql {:database-url "localhost"}
 :watchdude.state/app-db {}