Packages

  • package root

    This is the API documentation for Ciris: lightweight, extensible, and validated configuration loading in Scala.
    The documentation is kept up-to-date with new releases, currently documenting release v0.12.0 on Scala 2.12.
    Please note that the documentation targets the JVM, and there may be differences on Scala.js and Scala Native.

    This is the API documentation for Ciris: lightweight, extensible, and validated configuration loading in Scala.
    The documentation is kept up-to-date with new releases, currently documenting release v0.12.0 on Scala 2.12.
    Please note that the documentation targets the JVM, and there may be differences on Scala.js and Scala Native.

    Ciris is divided into the following set of modules.

    • The cats module integrates with cats for type classes and type class instances.
    • The cats-effect module integrates with cats-effect for type classes for effect types.
    • The core module provides basic functionality and support for standard library types.
    • The enumeratum module integrates with enumeratum to be able to read enumerations.
    • The generic module uses shapeless to be able to read products and coproducts.
    • The refined module integrates with refined to be able to read refinement types.
    • The spire module integrates with spire to be able to read more number types.
    • The squants module integrates with squants to read values with unit of measure.

    If you're looking for usage instructions, please refer to the usage guide.

    Definition Classes
    root
  • package ciris

    The main namespace of Ciris is ciris, and the easiest way to get started is to bring it into scope with an import.
    If you are looking for a getting started guide, with examples and explanations, please refer to the usage guide.

    The main namespace of Ciris is ciris, and the easiest way to get started is to bring it into scope with an import.
    If you are looking for a getting started guide, with examples and explanations, please refer to the usage guide.

    Definition Classes
    root
  • package api
    Definition Classes
    ciris
  • package cats

    Module providing an integration with cats.

    Module providing an integration with cats.

    Definition Classes
    ciris
  • package decoders
    Definition Classes
    ciris
  • package enumeratum

    Module providing an integration with enumeratum.

    Module providing an integration with enumeratum.

    Definition Classes
    ciris
  • package generic

    Module using shapeless for generic derivation of ConfigDecoders.

    Module using shapeless for generic derivation of ConfigDecoders.

    Definition Classes
    ciris
  • package refined

    Module providing an integration with refined.

    Module providing an integration with refined.

    Definition Classes
    ciris
  • package spire

    Module providing an integration with spire.

    Module providing an integration with spire.

    Definition Classes
    ciris
  • package squants

    Module providing an integration with squants.

    Module providing an integration with squants.

    Definition Classes
    ciris
  • ConfigDecoder
  • ConfigEntry
  • ConfigError
  • ConfigErrors
  • ConfigException
  • ConfigKeyType
  • ConfigResult
  • ConfigSource
  • ConfigValue
  • Secret

object ConfigSource extends ConfigSourcePlatformSpecific

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

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. def always[K, V](keyType: ConfigKeyType[K])(value: V): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType, where the source always returns the specified value -- that is, for every key of type K, the specified value is returned.

    Creates a new ConfigSource from the specified ConfigKeyType, where the source always returns the specified value -- that is, for every key of type K, the specified value is returned.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    value

    the value to always return for every key

    returns

    a new ConfigSource

  5. def alwaysF[F[_], K, V](keyType: ConfigKeyType[K])(value: F[V])(implicit arg0: Apply[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType, where the source always returns the specified value -- that is, for every key of type K, the specified value is returned.

    Creates a new ConfigSource from the specified ConfigKeyType, where the source always returns the specified value -- that is, for every key of type K, the specified value is returned. The value is wrapped in a context of type F -- which can be api.Id if no context is desired. There exists a ConfigSource#always for the case where F is Id.

    F

    the context in which the value is wrapped

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    value

    the value to always return for every key

    returns

    a new ConfigSource

  6. def apply[K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ Either[ConfigError, V]): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning either a ConfigError or a value.

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning either a ConfigError or a value.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning an error or value for a key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource(ConfigKeyType[String]("identity key"))(key => Right(key))
      source: ConfigSource[api.Id, String, String] = ConfigSource(ConfigKeyType(identity key))
      
      scala> source.read("key").toStringWithValues
      res0: String = ConfigEntry(key, ConfigKeyType(identity key), Right(key))
  7. def applyF[F[_], K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ F[Either[ConfigError, V]])(implicit arg0: Apply[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning either a ConfigError or a value, wrapped in a context of type F -- which can be api.Id if no context is desired.

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning either a ConfigError or a value, wrapped in a context of type F -- which can be api.Id if no context is desired. ConfigSource#apply exists for the case where F is Id.

    F

    the context in which the values exists

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning an error or value for a key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.applyF[api.Id, String, String](ConfigKeyType[String]("identity key"))(key => Right(key))
      source: ConfigSource[api.Id, String, String] = ConfigSource(ConfigKeyType(identity key))
      
      scala> source.read("key").toStringWithValues
      res0: String = ConfigEntry(key, ConfigKeyType(identity key), Right(key))
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def byIndex[V](keyType: ConfigKeyType[Int])(indexedSeq: IndexedSeq[V]): ConfigSource[Id, Int, V]

    Creates a new ConfigSource from the specified ConfigKeyType and IndexedSeq[V].

    Creates a new ConfigSource from the specified ConfigKeyType and IndexedSeq[V]. The source will only contain entries for keys where the index exist in the specified sequence.

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    indexedSeq

    the sequence of indexed values

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.byIndex(ConfigKeyType.Argument)(Vector("a"))
      source: ConfigSource[api.Id, Int, String] = ConfigSource(Argument)
      
      scala> source.read(0).toStringWithValues
      res0: String = ConfigEntry(0, Argument, Right(a))
      
      scala> source.read(1).toStringWithValues
      res1: String = ConfigEntry(1, Argument, Left(MissingKey(1, Argument)))
  10. def byIndexF[F[_], V](keyType: ConfigKeyType[Int])(indexedSeq: F[IndexedSeq[V]])(implicit arg0: Apply[F]): ConfigSource[F, Int, V]

    Creates a new ConfigSource from the specified ConfigKeyType and IndexedSeq[V].

    Creates a new ConfigSource from the specified ConfigKeyType and IndexedSeq[V]. The source will only contain entries for keys where the index exist in the specified sequence. The values are wrapped in context F -- which can be api.Id if no context is desired. ConfigSource#byIndex also exists for the case where F is Id.

    F

    the context in which values are wrapped

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    indexedSeq

    the sequence of indexed values

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.byIndexF[api.Id, String](ConfigKeyType.Argument)(Vector("a"))
      source: ConfigSource[api.Id, Int, String] = ConfigSource(Argument)
      
      scala> source.read(0).toStringWithValues
      res0: String = ConfigEntry(0, Argument, Right(a))
      
      scala> source.read(1).toStringWithValues
      res1: String = ConfigEntry(1, Argument, Left(MissingKey(1, Argument)))
  11. def catchNonFatal[K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ V): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, catching any non-fatal exceptions.

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, catching any non-fatal exceptions. The source will only contain entries for keys K where the specified function does not throw an exception.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning a value for a key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.catchNonFatal(ConfigKeyType.Argument)(Vector("a"))
      source: ConfigSource[api.Id, Int, String] = ConfigSource(Argument)
      
      scala> source.read(0).toStringWithValues
      res0: String = ConfigEntry(0, Argument, Right(a))
      
      scala> source.read(1).toStringWithValues
      res1: String = ConfigEntry(1, Argument, Left(ReadException(1, Argument, java.lang.IndexOutOfBoundsException: 1)))
  12. def catchNonFatalF[F[_], K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ F[V])(implicit arg0: Applicative[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, catching any non-fatal exceptions.

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, catching any non-fatal exceptions. The source will only contain entries for keys K where the specified function does not throw an exception.

    Values will be wrapped in the context F -- which can be api.Id if no context is desired. ConfigSource#catchNonFatal exists for the case where F is Id.

    F

    the context in which values are wrapped

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning a value for a key

    returns

    a new ConfigSource

  13. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  14. def empty[K, V](keyType: ConfigKeyType[K]): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType, where the source is always empty -- that is, it has no value for any key of type K.

    Creates a new ConfigSource from the specified ConfigKeyType, where the source is always empty -- that is, it has no value for any key of type K.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    returns

    a new ConfigSource

  15. def emptyF[F[_], K, V](keyType: ConfigKeyType[K])(implicit arg0: Applicative[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType, where the source is always empty -- that is, it has no value for any key of type K.

    Creates a new ConfigSource from the specified ConfigKeyType, where the source is always empty -- that is, it has no value for any key of type K. The errors for the missing keys will be wrapped in a context of type F -- which can be api.Id if no context is desired. There exists a ConfigSource#empty for the case where F is Id.

    F

    the context in which the errors are wrapped

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    returns

    a new ConfigSource

  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  18. def failed[K, V](keyType: ConfigKeyType[K])(error: ConfigError): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType, where the source always return the specified ConfigError -- that is, for every key of type K, the specified error is returned.

    Creates a new ConfigSource from the specified ConfigKeyType, where the source always return the specified ConfigError -- that is, for every key of type K, the specified error is returned.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    error

    the error to always return for every key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.failed[String, String](ConfigKeyType.Environment)(ConfigError("error"))
      source: ConfigSource[api.Id, String, String] = ConfigSource(Environment)
      
      scala> source.read("key1").toStringWithValues
      res0: String = ConfigEntry(key1, Environment, Left(ConfigError(error)))
      
      scala> source.read("key2").toStringWithValues
      res1: String = ConfigEntry(key2, Environment, Left(ConfigError(error)))
  19. def failedF[F[_], K, V](keyType: ConfigKeyType[K])(error: F[ConfigError])(implicit arg0: Apply[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType, where the source always return the specified ConfigError -- that is, for every key of type K, the specified error is returned.

    Creates a new ConfigSource from the specified ConfigKeyType, where the source always return the specified ConfigError -- that is, for every key of type K, the specified error is returned. The error is wrapped in the context F -- which can be api.Id if no context is desired. ConfigSource#failed exists for the case when F is Id.

    F

    the context in which the error is wrapped

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    error

    the error to always return for every key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.failedF[api.Id, String, String](ConfigKeyType.Environment)(ConfigError("error"))
      source: ConfigSource[api.Id, String, String] = ConfigSource(Environment)
      
      scala> source.read("key1").toStringWithValues
      res0: String = ConfigEntry(key1, Environment, Left(ConfigError(error)))
      
      scala> source.read("key2").toStringWithValues
      res1: String = ConfigEntry(key2, Environment, Left(ConfigError(error)))
  20. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. def fromEntries[K, V](keyType: ConfigKeyType[K])(entries: (K, V)*): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and entries with keys of type K and values of type V.

    Creates a new ConfigSource from the specified ConfigKeyType and entries with keys of type K and values of type V. For every key K in the entries, the corresponding value V is returned. If there is more than one entry with the same key, the value in the last entry is the one returned.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    entries

    the entries which the source should contain

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.fromEntries(ConfigKeyType.Argument)(0 -> "abc", 0 -> "def", 1 -> "ghi")
      source: ConfigSource[api.Id, Int, String] = ConfigSource(Argument)
      
      scala> source.read(0).toStringWithValues
      res0: String = ConfigEntry(0, Argument, Right(def))
      
      scala> source.read(1).toStringWithValues
      res1: String = ConfigEntry(1, Argument, Right(ghi))
      
      scala> source.read(2).toStringWithValues
      res2: String = ConfigEntry(2, Argument, Left(MissingKey(2, Argument)))
  22. def fromEntriesF[F[_], K, V](keyType: ConfigKeyType[K])(entries: F[Seq[(K, V)]])(implicit arg0: Apply[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and entries with keys of type K and values of type V.

    Creates a new ConfigSource from the specified ConfigKeyType and entries with keys of type K and values of type V. For every key K in the entries, the corresponding value V is returned. If there is more than one entry with the same key, the value in the last entry is the one returned.

    The entries are wrapped in a context F -- which can be api.Id if no context is desired. ConfigSource#fromEntries also exists for the case where F is Id.

    F

    the context in which the values are wrapped

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    entries

    the entries which the source should contain

    returns

    a new ConfigSource

  23. def fromMap[K, V](keyType: ConfigKeyType[K])(map: Map[K, V]): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and Map with keys of type K and values of type V.

    Creates a new ConfigSource from the specified ConfigKeyType and Map with keys of type K and values of type V. For every key K in the Map, the corresponding value V is returned.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    map

    the map which entries the source should contain

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.fromMap(ConfigKeyType.Environment)(sys.env)
      source: ConfigSource[api.Id, String, String] = ConfigSource(Environment)
      
      scala> source.read("key").toStringWithValues
      res0: String = ConfigEntry(key, Environment, Left(MissingKey(key, Environment)))
  24. def fromMapF[F[_], K, V](keyType: ConfigKeyType[K])(map: F[Map[K, V]])(implicit arg0: Apply[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and Map with keys of type K and values of type V.

    Creates a new ConfigSource from the specified ConfigKeyType and Map with keys of type K and values of type V. For every key K in the Map, the corresponding value V is returned, wrapped in the context F -- which can be api.Id if no context is desired. ConfigSource#fromMap also exists for the case when F is Id.

    F

    the context in which the map values are wrapped

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    map

    the map which entries the source should contain

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.fromMapF[api.Id, String, String](ConfigKeyType.Environment)(sys.env)
      source: ConfigSource[api.Id, String, String] = ConfigSource(Environment)
      
      scala> source.read("key").toStringWithValues
      res0: String = ConfigEntry(key, Environment, Left(MissingKey(key, Environment)))
  25. def fromOption[K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ Option[V]): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning an optional value.

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning an optional value.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning an optional value for a key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.fromOption(ConfigKeyType.Environment)(sys.env.get)
      source: ConfigSource[api.Id, String, String] = ConfigSource(Environment)
      
      scala> source.read("key").toStringWithValues
      res0: String = ConfigEntry(key, Environment, Left(MissingKey(key, Environment)))
  26. def fromOptionF[F[_], K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ F[Option[V]])(implicit arg0: Apply[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning an optional value, wrapped in a context of type F -- which can be api.Id if no context is desired.

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning an optional value, wrapped in a context of type F -- which can be api.Id if no context is desired. There exists a ConfigSource#fromOption for the case where F is Id.

    F

    the context in which the values exists

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning an optional value for a key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.fromOptionF[api.Id, String, String](ConfigKeyType.Environment)(sys.env.get)
      source: ConfigSource[api.Id, String, String] = ConfigSource(Environment)
      
      scala> source.read("key").toStringWithValues
      res0: String = ConfigEntry(key, Environment, Left(MissingKey(key, Environment)))
  27. def fromTry[K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ Try[V]): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning a Try[V].

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning a Try[V]. The source will only contain entries where the specified function returns Success[V] for the key K.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning Try[V] for a key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.fromTry(ConfigKeyType.Argument)(index => scala.util.Try(Vector("a")(index)))
      source: ConfigSource[api.Id, Int, String] = ConfigSource(Argument)
      
      scala> source.read(0).toStringWithValues
      res0: String = ConfigEntry(0, Argument, Right(a))
      
      scala> source.read(1).toStringWithValues
      res1: String = ConfigEntry(1, Argument, Left(ReadException(1, Argument, java.lang.IndexOutOfBoundsException: 1)))
  28. def fromTryF[F[_], K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ F[Try[V]])(implicit arg0: Apply[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning a F[Try[V]].

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning a F[Try[V]]. The source will only contain entries where the specified function returns Success[V] for the key K.

    F

    the context in which values are wrapped

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning Try[V] for a key

    returns

    a new ConfigSource

  29. def fromTryOption[K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ Try[Option[V]]): ConfigSource[Id, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning a Try[Option[V]].

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning a Try[Option[V]]. The source will only contain entries where the specified function returns Success[Some[V]] for the key K.

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning Try[Option[V]] for a key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.fromTryOption(ConfigKeyType.Property)(key => scala.util.Try(sys.props.get(key)))
      source: ConfigSource[api.Id, String, String] = ConfigSource(Property)
      
      scala> source.read("key").toStringWithValues
      res0: String = ConfigEntry(key, Property, Left(MissingKey(key, Property)))
      
      scala> source.read("").toStringWithValues
      res1: String = ConfigEntry(, Property, Left(ReadException(, Property, java.lang.IllegalArgumentException: key can't be empty)))
  30. def fromTryOptionF[F[_], K, V](keyType: ConfigKeyType[K])(read: (K) ⇒ F[Try[Option[V]]])(implicit arg0: Apply[F]): ConfigSource[F, K, V]

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning a F[Try[Option[V]]].

    Creates a new ConfigSource from the specified ConfigKeyType and read function, reading values of type V for keys of type K, returning a F[Try[Option[V]]]. The source will only contain entries where the specified function returns Success[Some[V]]for the key K.

    F

    the context in which values are wrapped

    K

    the type of keys the source supports

    V

    the type of values the source reads

    keyType

    the name and type of keys the source supports

    read

    a function returning Try[Option[V]] for a key

    returns

    a new ConfigSource

    Example:
    1. scala> val source = ConfigSource.fromTryOptionF[api.Id, String, String](ConfigKeyType.Property)(key => scala.util.Try(sys.props.get(key)))
      source: ConfigSource[api.Id, String, String] = ConfigSource(Property)
      
      scala> source.read("key").toStringWithValues
      res0: String = ConfigEntry(key, Property, Left(MissingKey(key, Property)))
      
      scala> source.read("").toStringWithValues
      res1: String = ConfigEntry(, Property, Left(ReadException(, Property, java.lang.IllegalArgumentException: key can't be empty)))
  31. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  32. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  35. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  37. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  38. def toString(): String
    Definition Classes
    AnyRef → Any
  39. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  42. object Environment extends ConfigSource[Id, String, String]

    ConfigSource reading environment variables from String keys.

  43. object File extends ConfigSource[Id, (File, Charset), String]

    ConfigSource reading file contents from File and Charset keys.

    ConfigSource reading file contents from File and Charset keys.

    Definition Classes
    ConfigSourcePlatformSpecific
  44. object Properties extends ConfigSource[Id, String, String]

    ConfigSource reading system properties from String keys.

Inherited from ConfigSourcePlatformSpecific

Inherited from AnyRef

Inherited from Any

Ungrouped