Package

zio

config

Permalink

package config

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

Type Members

  1. sealed trait ConfigDescriptor[A] extends AnyRef

    Permalink
    Definition Classes
    ConfigDescriptorModule
  2. trait ConfigDescriptorFunctions extends AnyRef

    Permalink
    Definition Classes
    ConfigDescriptorModule
  3. trait ConfigDescriptorModule extends ConfigSourceModule

    Permalink
    Annotations
    @silent( "Unused import" )
  4. sealed trait ConfigDocs extends AnyRef

    Permalink

    ConfigDocs holds the descriptions and details of a ConfigDescriptor which can be used to produce documentation.

    ConfigDocs holds the descriptions and details of a ConfigDescriptor which can be used to produce documentation.

    Definition Classes
    ConfigDocsModule
  5. trait ConfigDocsModule extends WriteModule

    Permalink
  6. trait ConfigModule extends ConfigDocsModule with ReadModule with WriteModule

    Permalink
  7. trait ConfigSource extends AnyRef

    Permalink
    Definition Classes
    ConfigSourceModule
  8. trait ConfigSourceFunctions extends AnyRef

    Permalink
    Definition Classes
    ConfigSourceModule
  9. trait ConfigSourceModule extends KeyValueModule

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

    Permalink
    Definition Classes
    ConfigSourceModule
  11. trait ConfigSourceStringModule extends ConfigSourceModule

    Permalink
  12. trait ConfigStringModule extends ConfigModule with ConfigSourceStringModule

    Permalink
  13. trait ImplicitTupleConversion extends AnyRef

    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. implicit class MapOps[A] extends AnyRef

    Permalink
  18. sealed trait PropertyTree[+K, +V] extends AnyRef

    Permalink
    Annotations
    @silent( "Unused import" )
  19. trait PropertyType[V, A] extends AnyRef

    Permalink
  20. trait PropertyTypePlatformSpecific extends AnyRef

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

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

    Permalink

    A Table is a recursive structure that is more easier to be interpreted as Json or Markdown than trying to convert ConfigDocs to a readable format.

    A Table is a recursive structure that is more easier to be interpreted as Json or Markdown than trying to convert ConfigDocs to a readable format.

    Definition Classes
    ConfigDocsModule
  23. trait TupleConversion[A, B] extends AnyRef

    Permalink
  24. abstract type V

    Permalink
    Definition Classes
    KeyValueModule

Value Members

  1. object BuildInfo extends Product with Serializable

    Permalink

    This object was generated by sbt-buildinfo.

  2. object ConfigDescriptor extends ConfigDescriptorFunctions

    Permalink
    Definition Classes
    ConfigStringModule
  3. object ConfigSource extends ConfigSourceFunctions

    Permalink
    Definition Classes
    ConfigSourceStringModule
  4. object ConfigSourceFunctions extends ConfigSourceFunctions

    Permalink
    Attributes
    protected
    Definition Classes
    ConfigSourceModule
  5. object LeafForSequence

    Permalink
    Definition Classes
    ConfigSourceModule
  6. object PropertyTree

    Permalink
  7. object PropertyType extends PropertyTypePlatformSpecific

    Permalink
  8. object ReadError extends Serializable

    Permalink
  9. object Table extends Serializable

    Permalink
    Definition Classes
    ConfigDocsModule
  10. object TupleConversion

    Permalink
  11. 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
  12. def addPostFixToKey(string: String): (String) ⇒ String

    Permalink

    Add a post fix to an existing key

    Add a post fix to an existing key

    Definition Classes
    KeyConversionFunctions
  13. def addPrefixToKey(prefix: String): (String) ⇒ String

    Permalink

    Add a prefix to an existing key

    Add a prefix to an existing key

    Definition Classes
    KeyConversionFunctions
  14. implicit macro def autoTupleConversion[P <: Product, T]: TupleConversion[P, T]

    Permalink
    Definition Classes
    ImplicitTupleConversion
  15. def autoTupleConversion1[P, A](implicit ev: TupleConversion[P, (A)]): TupleConversion[P, A]

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

    Permalink

    Convert camelCase to any delimited string.

    Convert camelCase to any delimited string. Example:

    camelToDelimiter("abcDef", "-") === abc-def
    Definition Classes
    KeyConversionFunctions
  17. 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.

    Once we generate the docs, this can be converted to a light weight Table structure which is much more easier to be converted to markdown or json formats.

    Example :

    val configDescriptor: ConfigDescriptor[MyAppConfig] = ???
    
    generatedDocs(configDescriptor).toTable.toGithubFlavouredMarkdown
    Definition Classes
    ConfigDocsModule
  18. 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
  19. final def getConfig[A](implicit tag: zio.Tag[A]): ZIO[Has[A], Nothing, A]

    Permalink
    Definition Classes
    ConfigModule
  20. 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
  21. final def read[A](configuration: config.ReadModule.ConfigDescriptor[A]): Either[ReadError[config.ReadModule.K], A]

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

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

    Permalink
    Definition Classes
    ReadModule
  24. package syntax

    Permalink
  25. val toKebabCase: (String) ⇒ String

    Permalink

    Convert a camelCase key to kebab-case val s = abcDef toKebabCase(s) === abc-def

    Convert a camelCase key to kebab-case val s = abcDef toKebabCase(s) === abc-def

    Definition Classes
    KeyConversionFunctions
  26. val toSnakeCase: (String) ⇒ String

    Permalink

    Convert a camelCase key to snake_case

    Convert a camelCase key to snake_case

    Definition Classes
    KeyConversionFunctions
  27. 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 ImplicitTupleConversion

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