diff options
author | vlad <vlad@driver.xyz> | 2017-02-16 14:09:55 -0800 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-02-16 14:09:55 -0800 |
commit | 3c9b0ed55e3721595dafa273b015dec6add8c18b (patch) | |
tree | 86878e9b62d72ca43cee5d3ac36e8037f3684c3a /src/main | |
parent | 0599531b1961d03cf251ff3b7c4c94ec65e37c57 (diff) | |
download | driver-core-0.10.10.tar.gz driver-core-0.10.10.tar.bz2 driver-core-0.10.10.zip |
Providing custom config for database configv0.10.10
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/scala/xyz/driver/core/database/database.scala | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/scala/xyz/driver/core/database/database.scala b/src/main/scala/xyz/driver/core/database/database.scala index 308c391..c14d0a5 100644 --- a/src/main/scala/xyz/driver/core/database/database.scala +++ b/src/main/scala/xyz/driver/core/database/database.scala @@ -1,29 +1,34 @@ package xyz.driver.core -import scala.concurrent.Future - import slick.backend.DatabaseConfig import slick.driver.JdbcProfile -import xyz.driver.core.time.Time import xyz.driver.core.date.Date +import xyz.driver.core.time.Time + +import scala.concurrent.Future package database { + import com.typesafe.config.Config + trait Database { val profile: JdbcProfile val database: JdbcProfile#Backend#Database } object Database { - - def fromConfig(databaseName: String): Database = { - val dbConfig: DatabaseConfig[JdbcProfile] = DatabaseConfig.forConfig(databaseName) + def fromConfig(config: Config, databaseName: String): Database = { + val dbConfig: DatabaseConfig[JdbcProfile] = DatabaseConfig.forConfig(databaseName, config) new Database { val profile: JdbcProfile = dbConfig.driver val database: JdbcProfile#Backend#Database = dbConfig.db } } + + def fromConfig(databaseName: String): Database = { + fromConfig(com.typesafe.config.ConfigFactory.load(), databaseName) + } } trait ColumnTypes { |