Razi Kheir
10/28/2019, 5:07 AMenvironment = jvmFlags overrides
systemEnv overrides
filesystem overrides
defaultConfig
Now most of the custom config (or all) for example is found under file system environment.
In this case environment will check JVM->System-> File (Finds them, life is amazing).
However this works only when my lenses are optional.
Example:
private val servicePortLens = <http://EnvironmentKey.int|EnvironmentKey.int>().*optional* ("SERVICE_PORT")
val servicePort = environment[servicePortLens]
However if I write it like this:
<http://EnvironmentKey.int|EnvironmentKey.int>().*required* ("SERVICE_PORT")
val servicePort = environment[servicePortLens]
The lens will try to check if it’s found under first environment (JVM) and throw when it doesn’t find it.
Exception in thread "x" java.lang.ExceptionInInitializerError
Caused by: org.http4k.lens.LensFailure: env 'SERVICE_PORT' is required
I would expect it to collect what it can from each environment until all fallbacks are exhausted no?