<@U4H0M349G> I’m in a pickle here, there is some t...
# http4k
r
@dave I’m in a pickle here, there is some time hack I did to make something work, but I don’t want to keep it like that. I will describe the situation:
Copy code
environment = 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:
Copy code
private val servicePortLens = <http://EnvironmentKey.int|EnvironmentKey.int>().*optional* ("SERVICE_PORT")
val servicePort = environment[servicePortLens]
However if I write it like this:
Copy code
<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.
Copy code
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?