All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.malliina.database.Conf.scala Maven / Gradle / Ivy

There is a newer version: 6.9.4
Show newest version
package com.malliina.database

import com.malliina.config.ConfigReadable
import com.malliina.config.ConfigReadable.ConfigOps

case class Conf(
  url: String,
  user: String,
  pass: String,
  driver: String,
  maxPoolSize: Int,
  autoMigrate: Boolean
)

object Conf:
  val MySQLDriver = "com.mysql.cj.jdbc.Driver"

  given ConfigReadable[Conf] = ConfigReadable.config.emap: c =>
    for
      url <- c.parse[String]("url")
      user <- c.parse[String]("user")
      pass <- c.parse[String]("pass")
      driver <- c.parse[String]("driver")
      maxPoolSize <- c.parse[Int]("maxPoolSize")
      autoMigrate <- c.parse[Boolean]("autoMigrate")
    yield Conf(url, user, pass, driver, maxPoolSize, autoMigrate)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy