Kotlin configuration library with batteries included
APACHE-2.0 License
Kotlin configuration library with batteries included.
2020-02-02
), times (10:15:30
), durations (20s
) and memory sizes (256 MB
)1
can be the string "1"
, the integer 1
, or the boolean true
implementation "dev.nohus:AutoKonfig:1.1.0"
<dependency>
<groupId>dev.nohus</groupId>
<artifactId>AutoKonfig</artifactId>
<version>1.1.0</version>
</dependency>
The artifacts are available on Maven Central.
Create a config file:
host = nohus.dev
port = 80
Create variables for your properties:
fun main() {
val host by StringSetting()
val port by IntSetting()
println("Host: $host, port: $port")
}
That's it! AutoKonfig automatically loaded your config file, because it had a well-known name. It knew which properties to load based on the variable names, and it mapped them to types based on the specified StringSetting
and IntSetting
delegates.
To see more, continue reading on the website.