[Request] TOML support in configuration module
milkory opened this issue · comments
Milk Ory commented
https://toml.io/en/
We should go forward.
黑 commented
TOML is really excellent, but user-friendly first
我们不应当增加用户的学习成本,Kether 就是例子。TOML 会列入更新计划,但不是现在。
黑 commented
module-configuration 已支持 TOML 文件
fun main() {
val configuration = Configuration.loadFromFile(File("test.toml"))
println(configuration.getInt("bar"))
println(configuration.getIntegerList("foo"))
configuration.set("time", System.currentTimeMillis())
configuration.saveToFile()
}
同时,你还可以使用 test.yml
格式来自动切换为到 YAML 文件。
val configuration = Configuration.loadFromFile(File("test.yml"))
以及基于 @Config
的配置文件注入也支持后缀判断。
@Config("config.toml")
lateinit var conf: Configuration
private set
黑 commented
If you like, please recommend TabooLib to your friends.
谢谢。