Object

zio.config.ConfigSourceStringModule

ConfigSource

Related Doc: package ConfigSourceStringModule

Permalink

object ConfigSource extends ConfigSourceFunctions

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

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def dropEmpty(trees: List[PropertyTree[K, V]]): List[PropertyTree[K, V]]

    Permalink
    Attributes
    protected
    Definition Classes
    ConfigSourceFunctions
  7. def dropEmpty(tree: PropertyTree[K, V]): PropertyTree[K, V]

    Permalink
    Attributes
    protected
    Definition Classes
    ConfigSourceFunctions
  8. val empty: ConfigSourceStringModule.ConfigSource

    Permalink
    Definition Classes
    ConfigSourceFunctions
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def fromCommandLineArgs(args: List[String], keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None): ConfigSourceStringModule.ConfigSource

    Permalink

    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") |@| string("password"))(Credentials.apply, Credentials.unapply)
    
    final case class Config(databaseCredentials: Credentials, vaultCredentials: Credentials, regions: List[String], users: List[String])
    
    (nested("db") { credentials } |@| nested("vault") { credentials } |@| list("regions")(string) |@| list("user")(string))(Config.apply, Config.unapply)
    
    // 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

  13. def fromMap(constantMap: Map[String, String], source: String = "constant", keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, leafForSequence: ConfigSourceStringModule.LeafForSequence = LeafForSequence.Valid): ConfigSourceStringModule.ConfigSource

    Permalink

    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") |@| string("SERDE"))(KafkaConfig.apply, KafkaConfig.unapply)

    leafForSequence indicates whether a Leaf(value) (i.e, a singleton) could be considered a Sequence.

  14. def fromMultiMap(map: Map[String, ::[String]], source: String = "constant", keyDelimiter: Option[Char] = None, leafForSequence: ConfigSourceStringModule.LeafForSequence = LeafForSequence.Valid): ConfigSourceStringModule.ConfigSource

    Permalink

    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") |@| string("SERDE"))(KafkaConfig.apply, KafkaConfig.unapply)

    leafForSequence indicates whether a Leaf(value) (i.e, a singleton) could be considered a Sequence.

  15. def fromProperties(property: Properties, source: String = "properties", keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, leafForSequence: ConfigSourceStringModule.LeafForSequence = LeafForSequence.Valid): ConfigSourceStringModule.ConfigSource

    Permalink

    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") |@| string("SERDE"))(KafkaConfig.apply, KafkaConfig.unapply)

    leafForSequence indicates whether a Leaf(value) (i.e, a singleton) could be considered a Sequence.

  16. def fromPropertiesFile[A](filePath: String, keyDelimiter: Option[Char] = None, valueDelimiter: Option[Char] = None, leafForSequence: ConfigSourceStringModule.LeafForSequence = LeafForSequence.Valid): Task[ConfigSourceStringModule.ConfigSource]

    Permalink

    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") |@| string("SERDE"))(KafkaConfig.apply, KafkaConfig.unapply)

    leafForSequence indicates whether a Leaf(value) (i.e, a singleton) could be considered a Sequence.

  17. def fromPropertyTree(tree: PropertyTree[K, V], source: String, leafForSequence: ConfigSourceStringModule.LeafForSequence): ConfigSourceStringModule.ConfigSource

    Permalink

    To obtain a config source directly from a property tree.

    To obtain a config source directly from a property tree.

    tree

    : PropertyTree

    source

    : Label the source with a name

    leafForSequence

    : Should a single value wrapped in Leaf be considered as Sequence

    Definition Classes
    ConfigSourceFunctions
  18. def fromPropertyTrees(trees: Iterable[PropertyTree[K, V]], source: String, leafForSequence: ConfigSourceStringModule.LeafForSequence): ConfigSourceStringModule.ConfigSource

    Permalink
    Attributes
    protected
    Definition Classes
    ConfigSourceFunctions
  19. def fromSystemEnv(keyDelimiter: Option[Char], valueDelimiter: Option[Char], leafForSequence: ConfigSourceStringModule.LeafForSequence = LeafForSequence.Valid): ZIO[System, ReadError[String], ConfigSourceStringModule.ConfigSource]

    Permalink

    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") |@| string("SERDE"))(KafkaConfig.apply, KafkaConfig.unapply)

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

  20. def fromSystemEnv: ZIO[System, ReadError[String], ConfigSourceStringModule.ConfigSource]

    Permalink
  21. def fromSystemEnvLive(keyDelimiter: Option[Char], valueDelimiter: Option[Char], leafForSequence: ConfigSourceStringModule.LeafForSequence = LeafForSequence.Valid): IO[ReadError[String], ConfigSourceStringModule.ConfigSource]

    Permalink

    For users that dont want to use layers in their application This method provides live system environment layer

  22. def fromSystemProperties(keyDelimiter: Option[Char], valueDelimiter: Option[Char], leafForSequence: ConfigSourceStringModule.LeafForSequence = LeafForSequence.Valid): UIO[ConfigSourceStringModule.ConfigSource]

    Permalink

    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") |@| string("SERDE"))(KafkaConfig.apply, KafkaConfig.unapply)
  23. def fromSystemProperties: UIO[ConfigSourceStringModule.ConfigSource]

    Permalink
  24. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  25. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  27. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  32. def unwrapSingletonLists(trees: List[PropertyTree[K, V]]): List[PropertyTree[K, V]]

    Permalink
    Attributes
    protected
    Definition Classes
    ConfigSourceFunctions
  33. def unwrapSingletonLists(tree: PropertyTree[K, V]): PropertyTree[K, V]

    Permalink
    Attributes
    protected
    Definition Classes
    ConfigSourceFunctions
  34. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped