Api

confuse.Api
trait Api extends MainApi with ReaderApi with StandardReaders with UnmarshalApi

Attributes

Graph
Supertypes
trait StandardStringReaders
trait LowPrioStringReaders
trait StringReaderApi
trait ReaderApi
trait MainApi
class Object
trait Matchable
class Any
Known subtypes
object default.type

Members list

Concise view

Type members

Inherited classlikes

object LocalDateReader extends StringReader[LocalDate]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[LocalDate]
class Object
trait Matchable
class Any
object LocalDateTimeReader extends StringReader[LocalDateTime]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[LocalDateTime]
class Object
trait Matchable
class Any
object LocalTime extends StringReader[LocalTime]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[LocalTime]
class Object
trait Matchable
class Any
object RangeReader extends StringReader[Range]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[Range]
class Object
trait Matchable
class Any
object Reader

Attributes

Inherited from:
ReaderApi
Graph
Supertypes
class Object
trait Matchable
class Any
trait Reader[A]

Attributes

Inherited from:
ReaderApi
Graph
Supertypes
class Object
trait Matchable
class Any

Attributes

Inherited from:
StringReaderApi
Graph
Supertypes
class Object
trait Matchable
class Any
trait StringReader[A]

Attributes

Inherited from:
StringReaderApi
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object LocalDateReader.type
object LocalTime.type
object RangeReader.type
object absPathReader.type
object booleanReader.type
object doubleReader.type
object durationReader.type
object floatReader.type
object instantReader.type
object jFileReader.type
object jPathReader.type
object pathReader.type
object relPathReader.type
object stringReader.type
object subPathReader.type
object absPathReader extends StringReader[Path]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[Path]
class Object
trait Matchable
class Any
object booleanReader extends StringReader[Boolean]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[Boolean]
class Object
trait Matchable
class Any
object doubleReader extends StringReader[Double]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[Double]
class Object
trait Matchable
class Any
object durationReader extends StringReader[Duration]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[Duration]
class Object
trait Matchable
class Any
object finiteDurationReader extends StringReader[FiniteDuration]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[FiniteDuration]
class Object
trait Matchable
class Any
object floatReader extends StringReader[Float]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[Float]
class Object
trait Matchable
class Any
object instantReader extends StringReader[Instant]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[Instant]
class Object
trait Matchable
class Any
object jFileReader extends StringReader[File]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[File]
class Object
trait Matchable
class Any
object jPathReader extends StringReader[Path]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[Path]
class Object
trait Matchable
class Any
object pathReader extends StringReader[FilePath]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[FilePath]
class Object
trait Matchable
class Any
object relPathReader extends StringReader[RelPath]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[RelPath]
class Object
trait Matchable
class Any
object stringReader extends StringReader[String]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[String]
class Object
trait Matchable
class Any
object subPathReader extends StringReader[SubPath]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[SubPath]
class Object
trait Matchable
class Any
object zonedDateTimeReader extends StringReader[ZonedDateTime]

Attributes

Inherited from:
StandardStringReaders
Graph
Supertypes
trait StringReader[ZonedDateTime]
class Object
trait Matchable
class Any

Value members

Inherited methods

def defaultEnvKeyReplacer: String => String

A function to transform the name of an environment variable into a configuration path.

A function to transform the name of an environment variable into a configuration path.

This can be overridden to globally change the behavior instead of overriding it in every call of read.

Attributes

Inherited from:
MainApi
def defaultReaders: Map[String, FileReader]

Configuration readers for file extensions.

Configuration readers for file extensions.

This can be overridden to globally change the behavior instead of overriding it in every call of read.

Attributes

Inherited from:
MainApi
def read(paths: Iterable[FilePath], pwd: Path, readers: Map[String, FileReader], env: Map[String, String], envPrefix: String, envKeyReplacer: String => String, envBinds: Iterable[(String, String)], props: Map[String, String], propsPrefix: String, propsBinds: Iterable[(String, String)], args: Iterable[(String, String)], dest: Config): Config

Read a configuration from various sources and formats.

Read a configuration from various sources and formats.

The configuration will be the result of merging configuration objects in the order of the parameters of this method. I.e.

  • start by reading files and directories
  • add configurations from environment variables
  • add configurations from system properties
  • add configuration from command line arguments

Merging of configuration objects means that object's keys are merged recursively. Other types however are replaced. Example:

Original

{
 "a": "lhs"
 "b": {
    "inner": {
       "foo": "lhs"
     }
  }
}

merge with

{
 "b": {
    "inner": {
       "foo": "rhs"
     }
  }
 "c": "rhs"
}

results in

{
 "a": "lhs"
 "b": {
    "inner": {
       "foo": "rhs"
     }
  }
 "c": "rhs"
}

Attributes

args

Command line arguments that should be interpreted as configurations.

dest

Root configuration object into which all other configuration will be merged. This can be set to build configurations through multiple calls to read. Defaults to an empty configuration.

env

Environment variables available for reading. Note that by default none will be read, unless other env* parameters are specified. Defaults to system environment variables.

envBinds

An association of environment variables to configuration paths. This is used to manually bind environment variables, for example if the prefix approach cannot be used. For example if the env contains SOME_SETTING=1 and the bindings contain "SOME_SETTING" -> "foo.bar", then this will result in the configuration foo.bar=1

envKeyReplacer

A function to transform the name of an environment variable into a configuration path. This overrides the default defaultEnvKeyReplacer if set.

envPrefix

Automatically read environment variables starting with this prefix, if set. Any environment variables read in such a way will have the prefix stripped before being transformed into a configuration path via the envKeyReplacer. For example if the env contains APP_FOO_BAR=1 and the prefix is given as APP_, then this will result in the configuration foo.bar=1.

paths

Paths of configuration files or directories containing config files. In case a path is a directory, it will be traversed for config files sorted in lexicographical order (only one level deep). In case a path is a file, it will be parsed based on extension. See the readers param.

props

System properties available for reading. Note that by default none will be read, unless other props* parameters are specified. Defaults to the current runtime's properties (on the JVM).

propsBinds

An association of properties to configuration paths. This is used to manually bind properties, for example if the prefix approach cannot be used. For example if the properties contain some.property=1 and the bindings contain "some.property" -> "foo.bar", then this will result in the configuration foo.bar=1

propsPrefix

Automatically read system properties starting with this prefix, if set. Any properties read in such a way will have the prefix stripped before being read as a configuration path. For example if the properties contain app.foo.bar=1 and the prefix is given as app., then this will result in the configuration foo.bar=1.

pwd

Root directory to use if files are given as relative paths. Defaults to current working directory.

readers

Additional readers for file extensions. See defaultReaders in the API trait.

Inherited from:
MainApi
def unmarshal[A](cfg: Config, path: List[String])(using reader: Reader[A]): A

Attributes

Inherited from:
UnmarshalApi
def unmarshalOrExit[A](cfg: Config, path: List[String], stderr: PrintStream, exit: Int => Nothing)(using reader: Reader[A]): A

Attributes

Inherited from:
UnmarshalApi
def watch(paths: Iterable[FilePath], pwd: Path, readers: Map[String, FileReader], env: Map[String, String], envPrefix: String, envKeyReplacer: String => String, envBinds: Iterable[(String, String)], props: Map[String, String], propsPrefix: String, propsBinds: Iterable[(String, String)], args: Iterable[(String, String)], dest: Config, onPreUpdate: Set[Path] => Unit, onUpdate: (Config, Config) => Unit, onError: ReadException => Unit): Closeable

Attributes

Inherited from:
PlatformApi

Givens

Inherited givens

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders
given LocalTime: LocalTime.type

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders
given colReader[Elem, Col <: (Iterable)](using elementReader: Reader[Elem], factory: Factory[Elem, Col[Elem]]): Reader[Col[Elem]]

Attributes

Inherited from:
StandardReaders
given collectionReader[Elem, Col <: (Iterable)](using elementReader: StringReader[Elem], factory: Factory[Elem, Col[Elem]]): collectionReader[Elem, Col]

Attributes

Inherited from:
LowPrioStringReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders
given given_Reader_A[A](using sr: StringReader[A]): Reader[A]

Attributes

Inherited from:
StandardReaders

Attributes

Inherited from:
StandardReaders

Attributes

Inherited from:
StandardReaders

Attributes

Inherited from:
StandardReaders
given given_Reader_Option[A](using r: Reader[A]): Reader[Option[A]]

Attributes

Inherited from:
StandardReaders

Attributes

Inherited from:
StandardReaders

Attributes

Inherited from:
StandardReaders

Attributes

Inherited from:
StandardStringReaders
given integralReader[N](using n: Integral[N]): integralReader[N]

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders
given mapReader[K, V, M <: ([K, V] =>> Iterable[(K, V)])](using kr: Reader[K], vr: Reader[V], factory: Factory[(K, V), M[K, V]]): Reader[M[K, V]]

Attributes

Inherited from:
StandardReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders
given tupleReader[K, V](using kr: StringReader[K], vr: StringReader[V]): tupleReader[K, V]

Attributes

Inherited from:
StandardStringReaders

Attributes

Inherited from:
StandardStringReaders