Razi Kheir
10/28/2019, 5:23 AMval servicePort: Int
private val servicePortLens = <http://EnvironmentKey.int|EnvironmentKey.int>().required("SERVICE_PORT")
val healthPort: Int
private val healthPortLens = <http://EnvironmentKey.int|EnvironmentKey.int>().required("HEALTH_PORT")
....
Other lenses/variables
...
servicePort = environment[servicePortLens]
healthPort = environment[healthPortLens]
...
Other variable assignments from lenses.
Couldn’t it be just:
data class Config(val servicePort: Int, val healthPort: Int, ...)
val config = environment[configLens]