Fork me on GitHub
#duct
<
2018-08-02
>
psdp01:08:40

is it possible to have multiple database connections with :duct.module/sql?

jahson14:08:16

[:duct.database.sql/hikaricp :some.database/db1]
 {:jdbc-url #duct/env ["JDBC_DATABASE_URL_DB1" Str]
  :zero-date-time-behavior "CONVERT_TO_NULL"
  :use-unicode true
  :character-encoding "UTF-8"
  :use-legacy-date-time-code false}

 [:duct.database.sql/hikaricp :some.database/db2]
 {:jdbc-url #duct/env ["JDBC_DATABASE_URL_DB2" Str]
  :zero-date-time-behavior "CONVERT_TO_NULL"
  :use-unicode true
  :character-encoding "UTF-8"
  :use-legacy-date-time-code false}

 :some.handler/create
 {:db #ig/ref :some.database/db1}

👍 4
dadair15:08:44

Basically, the key is to not use the module directly, but to use composite keys for the keys the module itself would add. The same pattern can be used for including multiple servers, multiple migrators, etc

jahson14:08:16

[:duct.database.sql/hikaricp :some.database/db1]
 {:jdbc-url #duct/env ["JDBC_DATABASE_URL_DB1" Str]
  :zero-date-time-behavior "CONVERT_TO_NULL"
  :use-unicode true
  :character-encoding "UTF-8"
  :use-legacy-date-time-code false}

 [:duct.database.sql/hikaricp :some.database/db2]
 {:jdbc-url #duct/env ["JDBC_DATABASE_URL_DB2" Str]
  :zero-date-time-behavior "CONVERT_TO_NULL"
  :use-unicode true
  :character-encoding "UTF-8"
  :use-legacy-date-time-code false}

 :some.handler/create
 {:db #ig/ref :some.database/db1}

👍 4
dadair17:08:36

Has anyone extended the pedestal logger protocol to work with the duct logger component? I’m using pedestal in duct, and want the pedestal logging capabilities, but want to use only :duct/logger rather than an additional pedestal logger.

johnj20:08:19

curious, why pedestal and not ring?

dadair21:08:32

While under a time crunch, I found it easier/more-documented to get websockets running through pedestal

dadair21:08:56

But now I’m also come to really like the interceptor model, so I reach for pedestal right away