Packages

object ConfigSource

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ConfigSource
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class ConfigSourceName(name: String) extends Product with Serializable
  2. type Managed[A] = ZIO[Scope, ReadError[K], A]
  3. type ManagedReader = ZIO[Scope, ReadError[K], TreeReader]
  4. type MemoizableManaged[A] = ZIO[Scope, Nothing, ZIO[Scope, ReadError[K], A]]
  5. type MemoizableManagedReader = ZIO[Scope, Nothing, ZIO[Scope, ReadError[K], TreeReader]]
  6. case class OrElse(self: ConfigSource, that: ConfigSource) extends ConfigSource with Product with Serializable
  7. case class Reader(names: Set[ConfigSourceName], access: MemoizableManagedReader) extends ConfigSource with Product with Serializable
  8. type TreeReader = (PropertyTreePath[K]) ⇒ ZIO[Any, ReadError[K], PropertyTree[K, V]]

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. val empty: ConfigSource
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. def fromCommandLineArgs(args: List[String], keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None): ConfigSource

    EXPERIMENTAL

    EXPERIMENTAL

    Assumption. All keys should start with -

    This source supports almost all standard command-line patterns including nesting/sub-config, repetition/list etc

    Example:

    Given:

    args = "-db.username=1 --db.password=hi --vault -username=3 --vault -password=10 --regions 111,122 --user k1 --user k2"
    keyDelimiter   = Some('.')
    valueDelimiter = Some(',')

    then, the following works:

    final case class Credentials(username: String, password: String)
    
    val credentials = (string("username") zip string("password")).to[Credentials]
    
    final case class Config(databaseCredentials: Credentials, vaultCredentials: Credentials, regions: List[String], users: List[String])
    
    (nested("db") { credentials } zip nested("vault") { credentials } zip list("regions")(string) zip list("user")(string)).to[Config]
    
    // res0 Config(Credentials(1, hi), Credentials(3, 10), List(111, 122), List(k1, k2))
    See also

    https://github.com/zio/zio-config/tree/master/examples/src/main/scala/zio/config/examples/commandline/CommandLineArgsExample.scala

  11. def fromManaged(sourceName: String, effect: ZIO[Scope, ReadError[String], TreeReader]): ConfigSource
  12. def fromMap(constantMap: Map[String, String], sourceName: String = "constant", keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, filterKeys: (String) ⇒ Boolean = _ => true): ConfigSource

    Provide keyDelimiter if you need to consider flattened config as a nested config.

    Provide keyDelimiter if you need to consider flattened config as a nested config. Provide valueDelimiter if you need any value to be a list

    Example:

    Given:

    map            = Map("KAFKA_SERVERS" -> "server1, server2", "KAFKA_SERDE"  -> "confluent")
    keyDelimiter   = Some('_')
    valueDelimiter = Some(',')

    then, the following works:

    final case class kafkaConfig(server: String, serde: String)
    nested("KAFKA")(string("SERVERS") zip string("SERDE")).to[KafkaConfig]
  13. def fromMultiMap(map: Map[String, ::[String]], sourceName: String = "constant", keyDelimiter: Option[Char] = None, filterKeys: (String) ⇒ Boolean = _ => true): ConfigSource

    Provide keyDelimiter if you need to consider flattened config as a nested config.

    Provide keyDelimiter if you need to consider flattened config as a nested config.

    Example:

    Given:

    map = Map("KAFKA_SERVERS" -> singleton(server1), "KAFKA_SERDE"  -> singleton("confluent"))
    keyDelimiter = Some('_')

    then, the following works:

    final case class kafkaConfig(server: String, serde: String)
    nested("KAFKA")(string("SERVERS") zip string("SERDE")).to[KafkaConfig]
  14. def fromProperties(property: Properties, sourceName: String = "properties", keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, filterKeys: (String) ⇒ Boolean = _ => true): ConfigSource

    Provide keyDelimiter if you need to consider flattened config as a nested config.

    Provide keyDelimiter if you need to consider flattened config as a nested config. Provide valueDelimiter if you need any value to be a list

    Example:

    Given:

    property      = "KAFKA.SERVERS" = "server1, server2" ; "KAFKA.SERDE" = "confluent"
    keyDelimiter   = Some('.')
    valueDelimiter = Some(',')

    then, the following works:

    final case class kafkaConfig(server: String, serde: String)
    nested("KAFKA")(string("SERVERS") zip string("SERDE")).to[KafkaConfig]
  15. def fromPropertiesFile[A](filePath: String, keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, filterKeys: (String) ⇒ Boolean = _ => true): ConfigSource

    Provide keyDelimiter if you need to consider flattened config as a nested config.

    Provide keyDelimiter if you need to consider flattened config as a nested config. Provide valueDelimiter if you need any value to be a list

    Example:

    Given:

    properties (in file) = "KAFKA.SERVERS" = "server1, server2" ; "KAFKA.SERDE" = "confluent"
    keyDelimiter         = Some('.')
    valueDelimiter       = Some(',')

    then, the following works:

    final case class kafkaConfig(server: String, serde: String)
    nested("KAFKA")(string("SERVERS") zip string("SERDE")).to[KafkaConfig]
  16. def fromPropertyTree(tree: PropertyTree[K, V], sourceName: String): ConfigSource

    To obtain a config source directly from a property tree.

    To obtain a config source directly from a property tree.

    tree

    : PropertyTree

    sourceName

    : Label the source with a name

  17. def fromSystemEnv(keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, filterKeys: (String) ⇒ Boolean = _ => true): ConfigSource

    Consider providing keyDelimiter if you need to consider flattened config as a nested config.

    Consider providing keyDelimiter if you need to consider flattened config as a nested config. Consider providing valueDelimiter if you need any value to be a list

    Example:

    Given:

    vars in sys.env  = "KAFKA_SERVERS" = "server1, server2" ; "KAFKA_SERDE" = "confluent"
    keyDelimiter     = Some('_')
    valueDelimiter   = Some(',')

    then, the following works:

    final case class kafkaConfig(server: String, serde: String)
    nested("KAFKA")(string("SERVERS") zip string("SERDE")).to[KafkaConfig]

    With filterKeys, you can choose to filter only those keys that needs to be considered.

    Note: The delimiter '.' for keys doesn't work in system environment.

  18. def fromSystemProps(keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, filterKeys: (String) ⇒ Boolean = _ => true): ConfigSource

    Consider providing keyDelimiter if you need to consider flattened config as a nested config.

    Consider providing keyDelimiter if you need to consider flattened config as a nested config. Consider providing valueDelimiter if you need any value to be a list

    Example:

    Given:

    vars in sys.props  = "KAFKA.SERVERS" = "server1, server2" ; "KAFKA.SERDE" = "confluent"
    keyDelimiter     = Some('.')
    valueDelimiter   = Some(',')

    then, the following works:

    final case class kafkaConfig(server: String, serde: String)
    nested("KAFKA")(string("SERVERS") zip string("SERDE")).to[KafkaConfig]
  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def getPropertyTreeFromArgs(args: List[String], keyDelimiter: Option[Char], valueDelimiter: Option[Char])(implicit KS: =:=[String, K], VS: =:=[String, V]): List[PropertyTree[K, V]]
  21. def getPropertyTreeFromMap(constantMap: Map[String, String], keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, filterKeys: (String) ⇒ Boolean = _ => true): PropertyTree[K, V]
  22. def getPropertyTreeFromMapA[A](map: Map[K, A])(f: (A) ⇒ ::[V], keyDelimiter: Option[Char]): PropertyTree[K, V]
  23. def getPropertyTreeFromProperties(property: Properties, keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, filterKeys: (String) ⇒ Boolean = _ => true): PropertyTree[K, V]
  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  29. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  30. def toString(): String
    Definition Classes
    AnyRef → Any
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped