When an integer is specified in a typesafe config file (application.conf) it is parsed as an Int when specified directly, but as a String when from an environment variable.
Required action
This is potentially a bug in the typesafe config library itself.
The wellcome-typesafe-app should be updated to handle this inconsistency, specifically in the EnrichConfig object (required / get / getOrElse).
Further info
The id_minter has crashed in production due to this issue:
Exception in thread "main" java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
at scala.runtime.BoxesRunTime.unboxToInt(BoxesRunTime.java:103)
at uk.ac.wellcome.platform.idminter.config.builders.RDSBuilder$.buildDB(RDSBuilder.scala:10)
at uk.ac.wellcome.platform.idminter.Main$.$anonfun$new$1(Main.scala:34)
at uk.ac.wellcome.typesafe.WellcomeTypesafeApp.runWithConfig(WellcomeTypesafeApp.scala:8)
at uk.ac.wellcome.typesafe.WellcomeTypesafeApp.runWithConfig$(WellcomeTypesafeApp.scala:6)
at uk.ac.wellcome.platform.idminter.Main$.runWithConfig(Main.scala:21)
at uk.ac.wellcome.platform.idminter.Main$.delayedEndpoint$uk$ac$wellcome$platform$idminter$Main$1(Main.scala:22)
at uk.ac.wellcome.platform.idminter.Main$delayedInit$body.apply(Main.scala:21)
at scala.Function0.apply$mcV$sp(Function0.scala:39)
at scala.Function0.apply$mcV$sp$(Function0.scala:39)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
at scala.App.$anonfun$main$1$adapted(App.scala:80)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.App.main(App.scala:80)
at scala.App.main$(App.scala:78)
at uk.ac.wellcome.platform.idminter.Main$.main(Main.scala:21)
at uk.ac.wellcome.platform.idminter.Main.main(Main.scala)
This console output illustrates the behaviour for environment variables:
Summary
When an integer is specified in a typesafe config file (
application.conf
) it is parsed as anInt
when specified directly, but as aString
when from an environment variable.Required action
This is potentially a bug in the typesafe config library itself.
The wellcome-typesafe-app should be updated to handle this inconsistency, specifically in the
EnrichConfig
object (required
/get
/getOrElse
).Further info
The
id_minter
has crashed in production due to this issue:This console output illustrates the behaviour for environment variables: