Created
June 4, 2021 19:57
-
-
Save iarenaza/866b5291a96ae6d757c8af8f11d6958e to your computer and use it in GitHub Desktop.
Using two database connections (with separate db connection pools) with Duct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:duct.profile/base | |
{:duct.core/project-ns project-ns | |
[:duct.database.sql/hikaricp :duct.database.sql.hikaricp/postgres] | |
{:jdbc-url #duct/env ["JDBC_POSTGRES_URL" Str] | |
:minimum-idle 10 | |
:maximum-pool-size 25 | |
;; Other HikariCP options go here. | |
} | |
[:project-ns.boundary.adapter.persistence/sql :project-ns.boundary.adapter.persistence.sql/postgres] | |
#ig/ref :duct.database.sql.hikaricp/postgres | |
[:duct.database.sql/hikaricp :duct.database.sql.hikaricp/sqlserver] | |
{:jdbc-url #duct/env ["JDBC_SQLSERVER_URL" Str] | |
:minimum-idle 10 | |
:maximum-pool-size 25 | |
;; Other HikariCP options go here. | |
} | |
[:project-ns.boundary.adapter.persistence/sql :project-ns.boundary.adapter.persistence.sql/sqlserver] | |
#ig/ref :duct.database.sql.hikaricp/sqlserver | |
[:duct/const :project-ns/common-config] {:db-postgres #ig/ref :project-ns.boundary.adapter.persistence.sql/postgres | |
:db-sqlserver #ig/ref :project-ns.boundary.adapter.persistence.sql/sqlserver | |
;; More config options go here. | |
} | |
:project-ns.api/user #ig/ref :project-ns/common-config | |
:project-ns.api/device #ig/ref :project-ns/common-config | |
;; Other Intengrant keys go here. | |
} ;; Base profile ends here | |
:duct.profile/dev #duct/include "dev" | |
:duct.profile/local #duct/include "local" | |
:duct.profile/prod {} | |
;; More Duct modules and profiles go here. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns project-ns.boundary.adapter.persistence.connector) | |
(defrecord Sql [spec]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns project-ns.boundary.adapter.persistence.sql | |
(:require [project-ns.boundary.adapter.persistence.connector :as connector] | |
;; Other namespaces that implement different protocols on the | |
;; `connector/Sql` record type go here. | |
[integrant.core :as ig])) | |
(defmethod ig/init-key :project-ns.boundary.adapter.persistence/sql [_ {:keys [spec]}] | |
(connector/->Sql spec)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment