Package 

Object ConfigManager

    • Method Detail

      • setConfigOverride

         final Unit setConfigOverride(String patchJson, Boolean enabled)

        Set (or clear) a JSON merge-patch applied on top of every fetched server config. enabled=false keeps the patch stored but inactive (server config is used verbatim). patchJson=null clears the stored patch. Throws IllegalArgumentException if a non-null patch isn't a JSON object. Persisted to CONFIG_PREFS so it survives process death. Call refreshInBackground afterward to re-fetch and apply immediately.

      • getEffectiveConfigJson

         final String getEffectiveConfigJson()

        The currently-applied config, serialized — seeds the editor's "current values" view.

      • refreshInBackground

         final Unit refreshInBackground()

        Best-effort re-fetch + apply (honours the override). Non-blocking.

      • fetch

         final AppConfiguration fetch()

        Single-shot fetch attempt. Returns the parsed config and applies it on HTTP 2xx, or returns null (and leaves the existing current in place) on any non-2xx, transport error, or decode failure. Useful for best-effort refreshes (e.g. after setAPIKey) where the caller doesn't want to block on the retry loop. Production session-start callers should use ensureLoaded instead.

      • ensureLoaded

         final AppConfiguration ensureLoaded()

        Returns the loaded config, blocking until a fetch has succeeded.

        On first call (or after every process restart) this drives an exponential-backoff retry loop — 1 s → 2 s → 4 s → ... capped at 2 h per attempt — until the config endpoint returns successfully. Concurrent callers share the single in-flight retry, so e.g. two simultaneous startDelivery(...) calls only produce one retry loop.

        The session-start path gates on this: if the config can't be fetched, startDelivery(...) won't fire newSession at all. Backoff state is in-memory and resets on every app launch, so a fresh process always starts from the initial 1 s delay regardless of prior failures.

      • preloadAsync

         final Unit preloadAsync()

        Async variant — kicks off the retry loop but doesn't suspend the caller. Useful from init so the config is likely already loaded by the time the host calls startDelivery(...).