Skip to content

fix(config): include media-auth policies in the config-YAML round-trip#24

Merged
ntt0601zcoder merged 1 commit into
mainfrom
fix/config-yaml-policies
Jun 15, 2026
Merged

fix(config): include media-auth policies in the config-YAML round-trip#24
ntt0601zcoder merged 1 commit into
mainfrom
fix/config-yaml-policies

Conversation

@ntt0601zcoder

Copy link
Copy Markdown
Owner

Problem

The unified /config/yaml bundle (what the console's YAML editor reads/writes) only carried global_config / templates / streams / hooks / vod — it never included the new media-auth Policy entities. So:

  • Policies didn't appear in the YAML view at all.
  • A YAML backup/restore silently dropped every policy.
  • A PUT /config/yaml containing a policies: key was rejected (INVALID_YAML, strict KnownFields decode).

Policies were only reachable via the /policies REST API (the Auth tab).

Fix

  • fullConfig gains a policies section; GetConfigYAML lists + emits it.
  • ReplaceConfigYAML applies policies (validate → upsert → ref-checked delete) before templates and streams (both reference a policy via playback_policy), then hot-reloads the authorizer so the change takes effect with no restart.
  • A policy still referenced by a desired stream or template cannot be deleted (mirrors the template ref-check).
  • ConfigHandler gains the policy repo + SetAuthorizer (wired in wireMediaAuth alongside the policy handler).

Tests

  • GET bundles policies; PUT applies + hot-reloads; invalid policy (require_token w/o secret) → 422; deleting a referenced policy is refused.
  • go build, go vet, golangci-lint (0 issues), go test -race ./... all green.

The unified /config/yaml bundle (GlobalConfig + templates + streams +
hooks + vod) never included the new media-auth Policy entities, so they
were invisible in the YAML editor and a YAML backup/restore silently
dropped every policy. PUT also rejected a `policies:` key outright via
the strict (KnownFields) decoder.

- fullConfig gains a `policies` section; GetConfigYAML lists and emits it.
- ReplaceConfigYAML applies policies (validate -> upsert -> ref-checked
  delete) BEFORE templates and streams, since both reference a policy via
  PlaybackPolicy, then hot-reloads the authorizer's compiled set so the
  change takes effect without a restart. A policy still referenced by a
  desired stream or template cannot be deleted.
- ConfigHandler gains the policy repo + SetAuthorizer (wired in
  wireMediaAuth alongside the policy handler).
@ntt0601zcoder ntt0601zcoder merged commit a3f121a into main Jun 15, 2026
4 checks passed
@ntt0601zcoder ntt0601zcoder deleted the fix/config-yaml-policies branch June 15, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant