LemonCore. ConfigReloader
(lemon_core v0.1.0)
View Source
Central orchestrator for runtime config reload.
Detects config changes from files, environment, and secrets, reloads the
canonical config, computes a redacted diff, and broadcasts update events
on LemonCore.Bus.
Reload Pipeline
- Acquire reload lock (serialize concurrent reloads)
- Compute current source digests
- Determine changed sources (skip if unchanged and not forced)
- If env source changed, reload
.env - Reload canonical config via
LemonCore.Config.reload/2 - Compute redacted diff vs previous snapshot
- Persist new snapshot + digests
- Broadcast
%LemonCore.Event{type: :config_reloaded}on topic"system" - On failure, keep last good snapshot and emit
:config_reload_failed
Telemetry
[:lemon, :config, :reload, :start][:lemon, :config, :reload, :stop][:lemon, :config, :reload, :exception]
Summary
Functions
Returns a specification to start this module under a supervisor.
Trigger a config reload.
Trigger a reload asynchronously. Fire-and-forget.
Starts the ConfigReloader GenServer.
Return current reloader status.
Return the list of file paths being watched.
Types
@type reload_result() :: %{ reload_id: String.t(), changed_sources: [source()], changed_paths: [String.t()], applied_at_ms: non_neg_integer(), actions: [map()] }
@type source() :: :files | :env | :secrets
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec reload(keyword()) :: {:ok, reload_result()} | {:error, term()}
Trigger a config reload.
Options
:sources- list of sources to check (default:[:files, :env, :secrets]):force- bypass digest comparison and force reload (default:false):reason- why the reload was triggered (:watcher,:poll,:manual,:secrets_event):cwd- override the working directory for config lookup:validate- run config validation (default:true)
@spec reload_async(keyword()) :: :ok
Trigger a reload asynchronously. Fire-and-forget.
Starts the ConfigReloader GenServer.
@spec status() :: map()
Return current reloader status.
@spec watch_paths() :: [String.t()]
Return the list of file paths being watched.