withAutoReload

fun withAutoReload(debounceMs: Long = 500): ConfigRef<T>

Starts a file watcher that automatically reloads the config when the file is modified on disk.

Changes are debounced — rapid successive writes trigger only one reload. If the new config differs, all onChange listeners are notified.

val config = YamlConfigManager.ref<DuelsConfig>(file)
.withAutoReload()
.onChange { _, new -> logger.info("Reloaded: ${new.serverId}") }

Return

This ConfigRef for chaining.

Since

1.0

Parameters

debounceMs

Debounce interval in milliseconds. Defaults to 500.

See also