ConfigLoader
Reads config values from a list of sources. The KSP processor adds a load<Spec>() extension for each @ConfigSpec class, which returns a ConfigResult:
val loader = ConfigLoader {
sources {
+EnvSource()
+TomlSource.fromFile("config.toml")
}
}
val config = loader.loadAppConfig().getOrThrow()Constructors
Creates a loader with the sources declared in block's ConfigLoaderBuilder.sources.
Properties
Functions
Runs load and reports, for every field, the value used and which source it came from. Secrets are shown as ***. A value that fails conversion or validation is still listed with its source; the error itself is in ConfigReport.result. Useful for debugging which file or variable won:
Loads a nullable nested spec under prefix. Returns null, so the field gets its default, when no source has any of the spec's keys; otherwise the spec loads as usual, and missing required keys are errors. Called by generated code.
Resolves one field from the sources in priority order. Called by generated code.