How do I access properties from `application.conf`...
# ktor
m
How do I access properties from
application.conf
from a non-Ktor object class?
j
Maybe you can recover them at initial stage, create a config class and inject that class wherever you need it. Does it sound like a good option?
a
Copy code
import com.typesafe.config.ConfigFactory
...
config = ConfigFactory.load()
j
Hi @aleksey.tomin Is there an easy way to disconnect from ConfigFactory to test later your code (is it an interface)? Is Ktor providing with a way to mock that config? Static calls are not that good when talking about testing.
👍 1
a
You can create
application.conf
in
test
directory
👍 1
j
Ok, that could work as well. Pointing to an environment can be done using the config recovered, so all the test scenarios can be recreated after.
147 Views