Package

zio

config

Permalink

package config

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. config
  2. ConfigStringModule
  3. ConfigSourceStringModule
  4. ConfigModule
  5. ReadModule
  6. ConfigDocsModule
  7. WriteModule
  8. ConfigDescriptorModule
  9. ConfigSourceModule
  10. KeyValueModule
  11. KeyConversionFunctions
  12. AnyRef
  13. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final case class AnnotatedRead[+A](value: A, annotations: Set[Annotation]) extends Product with Serializable

    Permalink
  2. sealed trait ConfigDescriptor[A] extends AnyRef

    Permalink
    Definition Classes
    ConfigDescriptorModule
  3. trait ConfigDescriptorFunctions extends AnyRef

    Permalink
    Definition Classes
    ConfigDescriptorModule
  4. trait ConfigDescriptorModule extends ConfigSourceModule

    Permalink
  5. sealed trait ConfigDocs extends AnyRef

    Permalink
    Definition Classes
    ConfigDocsModule
  6. trait ConfigDocsModule extends WriteModule

    Permalink
  7. trait ConfigModule extends ConfigDocsModule with ReadModule with WriteModule

    Permalink
  8. trait ConfigSource extends AnyRef

    Permalink
    Definition Classes
    ConfigSourceModule
  9. trait ConfigSourceFunctions extends AnyRef

    Permalink
    Definition Classes
    ConfigSourceModule
  10. trait ConfigSourceModule extends KeyValueModule

    Permalink
  11. case class ConfigSourceName(name: String) extends Product with Serializable

    Permalink
    Definition Classes
    ConfigSourceModule
  12. trait ConfigSourceStringModule extends ConfigSourceModule

    Permalink
  13. trait ConfigStringModule extends ConfigModule with ConfigSourceStringModule

    Permalink
  14. abstract type K

    Permalink
    Definition Classes
    KeyValueModule
  15. trait KeyValueModule extends AnyRef

    Permalink
  16. sealed trait LeafForSequence extends AnyRef

    Permalink

    To specify if a singleton leaf should be considered as a valid sequence or not.

    To specify if a singleton leaf should be considered as a valid sequence or not.

    Definition Classes
    ConfigSourceModule
  17. sealed trait PropertyTree[+K, +V] extends AnyRef

    Permalink
  18. trait PropertyType[V, A] extends AnyRef

    Permalink
  19. sealed trait ReadError[A] extends Exception with NoStackTrace

    Permalink
  20. case class Table(rows: List[TableRow]) extends Product with Serializable

    Permalink

    Definition Classes
    ConfigDocsModule
  21. abstract type V

    Permalink
    Definition Classes
    KeyValueModule
  22. type ZConfig[A] = Has[A]

    Permalink
    Definition Classes
    ConfigModule

Value Members

  1. object AnnotatedRead extends Serializable

    Permalink
  2. object BuildInfo extends Product with Serializable

    Permalink

    This object was generated by sbt-buildinfo.

  3. object ConfigDescriptor extends ConfigDescriptorFunctions

    Permalink
    Definition Classes
    ConfigStringModule
  4. object ConfigDescriptorAdt

    Permalink
    Definition Classes
    ConfigDescriptorModule
  5. object ConfigDocs

    Permalink
    Definition Classes
    ConfigDocsModule
  6. object ConfigSource extends ConfigSourceFunctions

    Permalink
    Definition Classes
    ConfigSourceStringModule
  7. object ConfigSourceFunctions extends ConfigSourceFunctions

    Permalink
    Attributes
    protected
    Definition Classes
    ConfigSourceModule
  8. object LeafForSequence

    Permalink
    Definition Classes
    ConfigSourceModule
  9. object PropertyTree

    Permalink
  10. object PropertyType

    Permalink
  11. object ReadError extends Serializable

    Permalink
  12. object Table extends Serializable

    Permalink
    Definition Classes
    ConfigDocsModule
  13. object These

    Permalink
  14. object ZConfig

    Permalink

    Use functions in this Config object when you need to retrieve your instance of config in terms of zio.Layer.

    Use functions in this Config object when you need to retrieve your instance of config in terms of zio.Layer.

    For example:

    final case class MyConfig(dburl: String, port: Int)
    
    val myConfigDesc: ConfigDescriptor[MyConfig]             = (string("dburl") |@| int("port"))(MyConfig.apply, MyConfig.unapply)
    val myConfig: Layer[ReadError[String], Config[MyConfig]] = Config.fromSystemEnv(myConfigDesc)

    By using Config.fromSystemEnv(myConfigDesc), it internally extends your description which is myConfigDesc to include the ConfigSource. In the above example, it is the ConfigSource corresponding to sys.env. It then calls zio.config.read with this new description that includes the source information.

    Extending an existing config description to include a ConfigSource is as simple as

    myConfigDesc from configSource

    Also, note that Config[MyConfig] in the above example is a simple type alias to Has[MyConfig].

    If you want to retrieve your config as scala.Either instead of zio.Layer, then you will have to extend your description to include the information on ConfigSource manually.

    For example:

    import zio.config._, ConfigDescriptor._
    final case class MyConfig(dburl: String, port: Int)
    
    val myConfig: ConfigDescriptor[MyConfig]         = (string("dburl") |@| int("port"))(MyConfig.apply, MyConfig.unapply)
    val constantSource: ConfigSource                 = ConfigSource.fromMap(Map("dburl" -> "xyz", "port" -> "8080"))
    val result: Either[ReadError[String], MyConfig]  = read(myConfig from constantSource)

    Note: With the above approach, we got a simple scala.Either instead of retrieving them in terms of ZIO. Instead of the above approach, if we use Config.fromMap(constantMap, myConfig), then we will get a Layer[ReadError[String], MyConfig]

    The above approach is especially useful when we have a custom ConfigSource. For instance, we can form a custom ConfigSource by composing a few existing ConfigSources.

    For example:

    import zio.config._, ConfigDescriptor._
    
    final case class MyConfig(dburl: String, port: Int)
    
    val myConfig: ConfigDescriptor[MyConfig]     = (string("dburl") |@| int("port"))(MyConfig.apply, MyConfig.unapply)
    val sysEnvSource: UIO[MyConfig]              = ConfigSource.fromSystemEnv
    val constantSource: ConfigSource             = ConfigSource.fromMap(Map("dburl" -> "xyz", "port" -> "8080"))
    val result: IO[ReadError[String], MyConfig]  = configSource.flatMap(source => read(myConfig from sysEnvSource.orElse(constantSource))

    In the above example, the results returned an UIO because of the existence of ConfigSource corresponding to sys.env.

    Definition Classes
    ConfigStringModule
  15. def addPrefix(prefix: String): (String) ⇒ String

    Permalink
    Definition Classes
    KeyConversionFunctions
  16. def camelToDelimiter(input: String, delimiter: String): String

    Permalink
    Definition Classes
    KeyConversionFunctions
  17. def foldReadError[B](error: ReadError[config.ReadModule.K])(alternative: B)(f: PartialFunction[ReadError[config.ReadModule.K], B])(g: (B, B) ⇒ B, zero: B): B

    Permalink
    Definition Classes
    ReadModule
  18. final def generateDocs[A](config: config.ConfigDocsModule.ConfigDescriptor[A]): ConfigDocs

    Permalink

    Generate documentation based on the ConfigDescriptor, where a ConfigDescriptor is a structure representing the logic to fetch the application config from various sources.

    Generate documentation based on the ConfigDescriptor, where a ConfigDescriptor is a structure representing the logic to fetch the application config from various sources.

    Definition Classes
    ConfigDocsModule
  19. def generateReport[A](config: config.ConfigDocsModule.ConfigDescriptor[A], value: A): Either[String, ConfigDocs]

    Permalink

    Generate a report based on the ConfigDescriptor and an A, where a ConfigDescriptor represents the logic to fetch the application config from various sources, and A represents the actual config value that was retrieved.

    Generate a report based on the ConfigDescriptor and an A, where a ConfigDescriptor represents the logic to fetch the application config from various sources, and A represents the actual config value that was retrieved.

    Definition Classes
    ConfigDocsModule
  20. final def getConfig[A](implicit tag: zio.Tag[A]): ZIO[ZConfig[A], Nothing, A]

    Permalink
    Definition Classes
    ConfigModule
  21. def getConfigSource(sourceNames: Set[ConfigSourceName], getTree: (List[config.ConfigSourceModule.K]) ⇒ PropertyTree[config.ConfigSourceModule.K, config.ConfigSourceModule.V], isLeafValidSequence: LeafForSequence): ConfigSource

    Permalink
    Attributes
    protected
    Definition Classes
    ConfigSourceModule
  22. def handleDefaultValues[A, B](error: ReadError[config.ReadModule.K], config: config.ReadModule.ConfigDescriptor[A], default: B): Either[ReadError[config.ReadModule.K], AnnotatedRead[B]]

    Permalink
    Definition Classes
    ReadModule
  23. def parseErrorMessage(given: String, expectedType: String): String

    Permalink
    Definition Classes
    ReadModule
  24. def postFix(string: String): (String) ⇒ String

    Permalink
    Definition Classes
    KeyConversionFunctions
  25. final def read[A](configuration: config.ReadModule.ConfigDescriptor[A]): Either[ReadError[config.ReadModule.K], A]

    Permalink
    Definition Classes
    ReadModule
  26. final def requiredZipAndOrFields[A](config: config.ReadModule.ConfigDescriptor[A]): Int

    Permalink
    Definition Classes
    ReadModule
  27. def sizeOfZipAndOrErrors(error: ReadError[config.ReadModule.K]): Int

    Permalink
    Definition Classes
    ReadModule
  28. package syntax

    Permalink
  29. val toKebabCase: (String) ⇒ String

    Permalink
    Definition Classes
    KeyConversionFunctions
  30. val toSnakeCase: (String) ⇒ String

    Permalink
    Definition Classes
    KeyConversionFunctions
  31. final def write[A](config: config.WriteModule.ConfigDescriptor[A], a: A): Either[String, PropertyTree[config.WriteModule.K, config.WriteModule.V]]

    Permalink
    Definition Classes
    WriteModule

Inherited from ConfigStringModule

Inherited from ConfigSourceStringModule

Inherited from ConfigModule

Inherited from ReadModule

Inherited from ConfigDocsModule

Inherited from WriteModule

Inherited from ConfigDescriptorModule

Inherited from ConfigSourceModule

Inherited from KeyValueModule

Inherited from KeyConversionFunctions

Inherited from AnyRef

Inherited from Any

Ungrouped