Skip to content

Alternative duct module for sql database that allows to have many dbs urls in one config

Notifications You must be signed in to change notification settings

mariusz-jachimowicz-83/duct-env-dbs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

duct-env-dbs

Alternative implementation of Duct module.sql.
It allows to specify multiple db urls in one config file and initialize db pool using url based on environment name from config file.
It allows me to easier launch 2 duct systems in parallel during development - one for dev and one for tests so I can easily run tests against db from the REPL.

CircleCI

Installation

Clojars Project

Usage

To add this module to your configuration, add the :duct-env-dbs.module/sql key with dbs configuration:

{:duct-env-dbs.module/sql {:development {:database-url "jdbc:sqlite:db/example_dev.sqlite"}
                           :production  {:database-url "jdbc:sqlite:db/example_prod.sqlite"}
                           :testing     {:database-url "jdbc:sqlite:db/example_test.sqlite"}}}

or

{:duct-env-dbs.module/sql {:development #duct/env ["DB_URL_DEV"  Str]
                           :production  #duct/env ["DB_URL_PROD" Str]
                           :testing     #duct/env ["DB_URL_TEST" Str]}}}

In all places when you need use db you need to reference :duct.database/sql same way as in Duct module.sql:

{:some-component {:db (ig/ref :duct.database/sql)}}

License

Copyright © 2018 Mariusz Jachimowicz

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Alternative duct module for sql database that allows to have many dbs urls in one config

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published