watchUrl

fun watchUrl(url: URL, period: 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 url, and reloads values periodically.

Format of the url is auto-detected from the url extension. Supported url formats and the corresponding extensions:

  • HOCON: conf

  • JSON: json

  • Properties: properties

  • TOML: toml

  • XML: xml

  • YAML: yml, yaml

Throws UnsupportedExtensionException if the url extension is unsupported.

Return

a child config containing values from specified url

Parameters

url

specified url

period

reload period. 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 URL is loaded

Throws

fun watchUrl(url: String, period: 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 url string, and reloads values periodically.

Format of the url is auto-detected from the url extension. Supported url formats and the corresponding extensions:

  • HOCON: conf

  • JSON: json

  • Properties: properties

  • TOML: toml

  • XML: xml

  • YAML: yml, yaml

Throws UnsupportedExtensionException if the url extension is unsupported.

Return

a child config containing values from specified url string

Parameters

url

specified url string

period

reload period. 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 URL is loaded

Throws