A type-safe cascading configuration library for Kotlin/Java/Android, supporting most configuration formats
Loader#watchFile
doesn't work on macOSwithFallback
API for config specAfter migrated to tree-based source APIs, many deprecated APIs are removed, including:
Source
: all isXXX
and toXXX
APIsConfig
: layer
, addSource
and withSourceFrom
feature: support JavaScript source using GraalVM JavaScript
fix: doesn't close input/output stream in provider/writer
Konf is modularized, now you can use different modules for different sources without unnecessary dependencies.
After modularized Konf, hocon
/toml
/xml
/yaml
/git
/watchGit
in DefaultLoaders
become extension properties/functions and should be imported explicitly.
For example, you should import com.uchuhimo.konf.source.hocon
before using config.from.hocon
; in Java, config.from().hocon
is unavailable, please use config.from().source(HoconProvider.INSTANCE)
instead.
config.containsRequired()
(return true/false) and config.validateRequired()
(throw exception instead) to check whether all values of required items exist in config or notonSet
for Item
mapped
API for DefaultLoaders
FAIL_ON_UNKNOWN_PATH
enabled, an exception is thrown when loading from the source to indicate it contains unknown pathsAPIs in ConfigSpec
have been updated to support item name's auto-detection, please migrate to new APIs. Here are some examples:
val host = optional("host", "0.0.0.0")
to val host by optional("0.0.0.0")
val port = required<Int>("port")
to val port by required<Int>()
val nextPort = lazy("nextPort") { config -> config[port] + 1 }
to val nextPort by lazy { config -> config[port] + 1 }
Thanks to our contributors whose commits are featured in this release:
@DALDEI