Retrieve a ConfigSource
from typesafe-config
from a given config file
Retrieve a ConfigSource
from typesafe-config
from a given config file
A complete example usage:
val configSource = TypesafeConfigSource.fromHoconFile(new File("/path/to/xyz.hocon")) case class MyConfig(port: Int, url: String) val result: Task[MyConfig] = configSource.flatMap(source => ZIO.fromEither(read(descriptor[MyConfig] from source))
Retrieve a ConfigSource
from typesafe-config
from a path to a config file
Retrieve a ConfigSource
from typesafe-config
from a path to a config file
A complete example usage:
val configSource = TypesafeConfigSource.fromHoconFilePath("/path/to/xyz.hocon") case class MyConfig(port: Int, url: String) val result: Task[MyConfig] = read(descriptor[MyConfig] from configSource)
Retrieve a ConfigSource
from typesafe-config
HOCON string.
Retrieve a ConfigSource
from typesafe-config
HOCON string.
A complete example usage:
val hocon = s""" { port : 8080 url : abc.com } """ val configSource = TypesafeConfigSource.fromHoconString(hocon) case class MyConfig(port: Int, url: String) val result: Either[ReadError[String], MyConfig] = configSource.flatMap(source => read(descriptor[MyConfig] from source)))
Retrieve a ConfigSource
from typesafe-config
from a given file in resource classpath.
Retrieve a ConfigSource
from typesafe-config
from a given file in resource classpath.
A complete example usage:
case class MyConfig(port: Int, url: String) val result: IO[ReadError[String], MyConfig] = read(descriptor[MyConfig] from TypesafeConfigSource.fromResourcePath))
Retrieve a ConfigSource
from typesafe-config
data type.
Retrieve a ConfigSource
from typesafe-config
data type.
A complete example usage:
val hocon = s""" { port : 8080 url : abc.com } """ val configSource = TypesafeConfigSource.fromTypesafeConfig(ZIO.attempt(ConfigFactory.load.resolve)) case class MyConfig(port: Int, url: String) val result: Either[ReadError[String], MyConfig] = configSource.flatMap(source => read(descriptor[MyConfig] from source)))
We are ending up calling memoize
(without leaving it to the user)
is some of th limitations in typesafe/config project such as:
https://github.com/lightbend/config/issues/30 (open as of 29/12/2021)