Skip to content

Commit

Permalink
refactor!:Make implicit ConfigReader field names as unique as possible
Browse files Browse the repository at this point in the history
BREAKING CHANGE: public implicits renamed

We want to prevent name collision which breaks user code and is very
hard to detect.
  • Loading branch information
jakubjanecek committed Oct 23, 2019
1 parent c4a8d73 commit 5697873
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import pureconfig.generic.semiauto.deriveReader

trait ConfigReaders {

implicit val transactionIsolationReader: ConfigReader[TransactionIsolation] = ConfigReader[String].emap {
implicit val doobieTransactionIsolationReader: ConfigReader[TransactionIsolation] = ConfigReader[String].emap {
case "TRANSACTION_NONE" => TransactionIsolation.TransactionNone.asRight
case "TRANSACTION_READ_UNCOMMITTED" => TransactionIsolation.TransactionReadUncommitted.asRight
case "TRANSACTION_READ_COMMITTED" => TransactionIsolation.TransactionReadCommitted.asRight
Expand All @@ -18,6 +18,6 @@ trait ConfigReaders {
case unknown => Left(CannotConvert(unknown, "TransactionIsolation", "unknown value"))
}

implicit val configReader: ConfigReader[DoobieHikariConfig] = deriveReader
implicit val doobieDoobieHikariConfigReader: ConfigReader[DoobieHikariConfig] = deriveReader

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import pureconfig.generic.semiauto.deriveReader

trait ConfigReaders {

implicit private[pureconfig] val charsetReader: ConfigReader[Charset] = ConfigReader[String].emap { value =>
implicit private[pureconfig] val flywayCharsetReader: ConfigReader[Charset] = ConfigReader[String].emap { value =>
Either.catchNonFatal(Charset.forName(value)).leftMap(ExceptionThrown.apply)
}

implicit val migrationVersionReader: ConfigReader[MigrationVersion] = ConfigReader[String].map(MigrationVersion.fromVersion)
implicit val flywayMigrationVersionReader: ConfigReader[MigrationVersion] = ConfigReader[String].map(MigrationVersion.fromVersion)

implicit val configReader: ConfigReader[FlywayConfig] = deriveReader
implicit val flywayFlywayConfigReader: ConfigReader[FlywayConfig] = deriveReader

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import pureconfig.generic.semiauto.{deriveEnumerationReader, deriveReader}

trait ConfigReaders {

implicit val userAgentReader: ConfigReader[`User-Agent`] = ConfigReader[String].emap { value =>
implicit val http4sClientUserAgentReader: ConfigReader[`User-Agent`] = ConfigReader[String].emap { value =>
`User-Agent`.parse(value).leftMap { parseFailure =>
CannotConvert(value, "User-Agent HTTP header", parseFailure.message)
}
}

implicit val parserModeReader: ConfigReader[ParserMode] = deriveEnumerationReader
implicit val http4sClientParserModeReader: ConfigReader[ParserMode] = deriveEnumerationReader

implicit val http4sBlazeClientConfigReader: ConfigReader[Http4sBlazeClientConfig] = deriveReader
implicit val http4sClientHttp4sBlazeClientConfigReader: ConfigReader[Http4sBlazeClientConfig] = deriveReader

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import pureconfig.generic.semiauto.deriveReader

trait ConfigReaders {

implicit val socketOptionsReader: ConfigReader[SocketOptions] = deriveReader
implicit val http4sServerSocketOptionsReader: ConfigReader[SocketOptions] = deriveReader

implicit val http4sBlazeServerConfigReader: ConfigReader[Http4sBlazeServerConfig] = deriveReader
implicit val http4sServerHttp4sBlazeServerConfigReader: ConfigReader[Http4sBlazeServerConfig] = deriveReader

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import pureconfig.generic.semiauto.{deriveEnumerationReader, deriveReader}

trait ConfigReaders {

implicit val threadPoolExecutorConfigReader: ConfigReader[ThreadPoolExecutorConfig] = deriveReader
implicit val jvmThreadPoolExecutorConfigReader: ConfigReader[ThreadPoolExecutorConfig] = deriveReader

implicit val taskPeekingModeReader: ConfigReader[TaskPeekingMode] = deriveEnumerationReader
implicit val jvmTaskPeekingModeReader: ConfigReader[TaskPeekingMode] = deriveEnumerationReader

implicit val forkJoinPoolConfigReader: ConfigReader[ForkJoinPoolConfig] = deriveReader
implicit val jvmForkJoinPoolConfigReader: ConfigReader[ForkJoinPoolConfig] = deriveReader

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import pureconfig.generic.semiauto.deriveReader

trait ConfigReaders {

implicit val micrometerJmxConfigReader: ConfigReader[MicrometerJmxConfig] = deriveReader
implicit val micrometerMicrometerJmxConfigReader: ConfigReader[MicrometerJmxConfig] = deriveReader

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import pureconfig.generic.semiauto.deriveReader

trait ConfigReaders {

implicit val micrometerStatsDConfigReader: ConfigReader[MicrometerStatsDConfig] = deriveReader
implicit val micrometerMicrometerStatsDConfigReader: ConfigReader[MicrometerStatsDConfig] = deriveReader

}

0 comments on commit 5697873

Please sign in to comment.