watchGit

fun DefaultLoaders.watchGit(repo: String, file: String, dir: String? = null, branch: String = Constants.HEAD, period: Long = 1, unit: TimeUnit = TimeUnit.MINUTES, context: CoroutineContext = Dispatchers.Default, optional: Boolean = this.optional, onLoad: (config: Config, source: Source) -> Unit? = null): Config

Returns a child config containing values from a specified git repository, 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 a specified git repository

Parameters

repo

git repository

file

file in the git repository

dir

local directory of the git repository

branch

the initial branch

period

reload period. The default value is 1.

unit

time unit of reload period. The default value is TimeUnit.MINUTES.

context

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

optional

whether the source is optional

onLoad

function invoked after the updated git file is loaded

Throws

com.uchuhimo.konf.source.UnsupportedExtensionException
fun Loader.watchGit(repo: String, file: String, dir: String? = null, branch: String = Constants.HEAD, period: Long = 1, unit: TimeUnit = TimeUnit.MINUTES, context: CoroutineContext = Dispatchers.Default, optional: Boolean = this.optional, onLoad: (config: Config, source: Source) -> Unit? = null): Config

Returns a child config containing values from a specified git repository, and reloads values periodically.

Return

a child config containing values from a specified git repository

Parameters

repo

git repository

file

file in the git repository

dir

local directory of the git repository

branch

the initial branch

period

reload period. The default value is 1.

unit

time unit of reload period. The default value is TimeUnit.MINUTES.

context

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

optional

whether the source is optional

onLoad

function invoked after the updated git file is loaded