fix(config): include media-auth policies in the config-YAML round-trip#24
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The unified
/config/yamlbundle (what the console's YAML editor reads/writes) only carriedglobal_config / templates / streams / hooks / vod— it never included the new media-auth Policy entities. So:PUT /config/yamlcontaining apolicies:key was rejected (INVALID_YAML, strictKnownFieldsdecode).Policies were only reachable via the
/policiesREST API (the Auth tab).Fix
fullConfiggains apoliciessection;GetConfigYAMLlists + emits it.ReplaceConfigYAMLapplies policies (validate → upsert → ref-checked delete) before templates and streams (both reference a policy viaplayback_policy), then hot-reloads the authorizer so the change takes effect with no restart.ConfigHandlergains the policy repo +SetAuthorizer(wired inwireMediaAuthalongside the policy handler).Tests
go build,go vet,golangci-lint(0 issues),go test -race ./...all green.