Dispatch module for secret storage.
Resolves the active Planck.Agent.Secrets implementation from config and
delegates calls to it. Declare the implementation in config.json:
{ "secrets_hook": "Sidecar.Secrets.AgentVault" }When not set, Planck.Headless.Secrets.EnvFile is used — reads and writes
.planck/.env (default behaviour, unchanged from earlier releases).
Process environment sync
Whenever a secret is stored or deleted, the change is mirrored into the
OS process environment via System.put_env/2 or System.delete_env/1 and
ResourceStore.reload/0 is called so Skogsra picks up the new value without
a restart.
preload_to_env/0 loads all stored secrets into the process env at once —
call it at application boot and after .env file changes (EnvFile backend only).
Remote dispatch
When the configured module lives on the sidecar node (e.g.
Sidecar.Secrets.AgentVault), calls are dispatched via :rpc.call/5 to the
connected sidecar. If the sidecar is not connected, calls return
{:error, :sidecar_not_connected} (or %{} for fetch_all/0).
Planck.Headless.Secrets.EnvFile is always called in-process.
See Planck.Agent.Secrets for the behaviour definition.
Summary
Functions
Delete a secret and remove it from the process environment.
Delete the service rule for the given host.
Fetch a secret using the configured implementation.
Fetch all secrets as a map using the configured implementation.
List all secret keys using the configured implementation.
List all configured service rules.
Load all stored secrets into the OS process environment via System.put_env/2.
Return the configured secrets module, defaulting to EnvFile.
Store a secret and sync to the process environment.
Upsert a service rule for the given host.
Functions
Delete a secret and remove it from the process environment.
Delete the service rule for the given host.
Fetch a secret using the configured implementation.
@spec fetch_all() :: Planck.Agent.Secrets.t()
Fetch all secrets as a map using the configured implementation.
List all secret keys using the configured implementation.
@spec list_services() :: {:ok, [Planck.Agent.Secrets.service()]} | {:error, term()}
List all configured service rules.
@spec preload_to_env(atom() | nil) :: :ok
Load all stored secrets into the OS process environment via System.put_env/2.
When node is provided the secrets are fetched directly from that node via
RPC, bypassing SidecarManager.node/0. This is required when called from
within SidecarManager itself — calling SidecarManager.node/0 from inside
a GenServer callback would deadlock on a self-call.
Does NOT call ResourceStore.reload/0 — callers are responsible for
triggering a Skogsra refresh if needed.
@spec resolve() :: module()
Return the configured secrets module, defaulting to EnvFile.
Store a secret and sync to the process environment.
Upsert a service rule for the given host.