Targets file: named aliases and webhook env-var indirection.
Loaded from COMMS_TARGETS_FILE (default ~/.config/noizu-comms/targets.yaml;
precedence: load/1 :file opt > app env :noizu_comms, :targets_file >
env var > default).
targets:
ops-alerts: { uri: "discord://channel/123456789012345678", allow_write: true }
releases: { uri: "slack://channel/C0123456", allow_write: true }
keith-phone: { uri: "whatsapp://15551234567", allow_write: false }
webhooks: # alias -> env var NAME holding the URL (never the URL itself)
discord:
deploys: DISCORD_WEBHOOK_DEPLOYSToken env vars (DISCORD_BOT_TOKEN, SLACK_BOT_TOKEN, TELEGRAM_BOT_TOKEN,
WHATSAPP_ACCESS_TOKEN, WHATSAPP_PHONE_NUMBER_ID) belong to the SDKs and
are never stored in the targets file.
Summary
Functions
An empty config (used when the targets file is absent/unreadable).
Loads and parses the targets YAML. A missing file is an error here —
Looks up an alias -> {:ok, entry} or {:error, %Error{kind: :not_configured}}.
Targets file path (see precedence in the moduledoc).
Resolves a webhook URL for channel + alias. The config stores the env
var NAME; the URL itself is read from the environment at call time.
Types
Functions
@spec empty() :: t()
An empty config (used when the targets file is absent/unreadable).
@spec load(keyword()) :: {:ok, t()} | {:error, Noizu.Comms.Error.t()}
Loads and parses the targets YAML. A missing file is an error here —
@spec lookup(t(), String.t()) :: {:ok, target_entry()} | {:error, Noizu.Comms.Error.t()}
Looks up an alias -> {:ok, entry} or {:error, %Error{kind: :not_configured}}.
Targets file path (see precedence in the moduledoc).
@spec webhook_url(t() | nil, atom(), String.t()) :: {:ok, String.t()} | {:error, Noizu.Comms.Error.t()}
Resolves a webhook URL for channel + alias. The config stores the env
var NAME; the URL itself is read from the environment at call time.