/** * Makes a new reloadable service from a layer that describes the construction * of a static service. The service is automatically reloaded according to a * schedule, which is extracted from the input to the layer. * * @tsplus static effect/core/io/Reloadable.Ops autoFromConfig */ export function autoFromConfig( outTag: Tag, layer: Layer, scheduleFromConfig: (env: Env) => Schedule ): Layer> { return Layer.scoped( outTag.reloadable, Do(($) => { const input = $(Effect.environment()) const policy = scheduleFromConfig(input) const env = $(Reloadable.auto(outTag, layer, policy).build) return env.unsafeGet(outTag.reloadable) }) ) }