load

fun <T : Any> load(load: ConfigLoader.() -> ConfigResult<T>, context: CoroutineContext = EmptyCoroutineContext, sources: ConfigLoaderBuilder.() -> Unit): ReloadableConfig<T>(source)

Loads the config for the first time.

Parameters

load

reads the config from a loader, usually the generated load<Spec>().

context

where later reloads read their sources, e.g. Dispatchers.IO so a reload started from the main thread does not read files on it.

sources

declares the sources, and runs again on every reload.

Throws

if the first load fails, since there is no last good config yet.