watchFile

fun watchFile(file: File, delayTime: Long = 5, unit: TimeUnit = TimeUnit.SECONDS, context: CoroutineContext = Dispatchers.Default, optional: Boolean = this.optional, onLoad: (config: Config, source: Source) -> Unit? = null): Config

Returns a child config containing values from specified file, and reloads values when file content has been changed.

Return

a child config containing values from watched file

Parameters

file

specified file

delayTime

delay to observe between every check. The default value is 5.

unit

time unit of delay. The default value is TimeUnit.SECONDS.

context

context of the coroutine. The default value is Dispatchers.Default.

optional

whether the source is optional

onLoad

function invoked after the updated file is loaded

fun watchFile(file: String, delayTime: Long = 5, unit: TimeUnit = TimeUnit.SECONDS, context: CoroutineContext = Dispatchers.Default, optional: Boolean = this.optional, onLoad: (config: Config, source: Source) -> Unit? = null): Config

Returns a child config containing values from specified file path, and reloads values when file content has been changed.

Return

a child config containing values from watched file

Parameters

file

specified file path

delayTime

delay to observe between every check. The default value is 5.

unit

time unit of delay. The default value is TimeUnit.SECONDS.

context

context of the coroutine. The default value is Dispatchers.Default.

optional

whether the source is optional

onLoad

function invoked after the updated file is loaded