Repository navigation
Conversation
Self-hosted deployments sometimes want every template created by any team to be publicly visible platform-wide, rather than private-by-default. Today the public flag is hardcoded false for newly created templates (only inherited on same-alias rebuilds), with no config/env/request path to change it. Add an opt-in env var TEMPLATES_DEFAULT_PUBLIC, read in RegisterBuild (the single funnel for the V1/V2/V3 create paths) and applied after the rebuild-inheritance so it overrides the stored value for both the DB row and the API response. Unset / false / unparseable keeps the original private-by-default behavior, so this is fully backward compatible.
AdaAibaby
requested review from
ValentaTomas,
dobrac and
jakubno
as code owners
October 20, 2026 06:17
This branch has not been deployed
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.
Summary
Makes the default visibility of newly created templates configurable (public vs private) via an opt-in env var
TEMPLATES_DEFAULT_PUBLIC, instead of it being fixed in code.This is a configuration knob, not a mandate to make templates public:
false/ invalid → private by default (today's behavior, unchanged);true/1→ new templates default to public (for deployments that want a shared, platform-wide catalog).Closes #3703.
Why
The
publicflag for a newly created template is effectively hardcodedfalse(only inherited on same-alias, same-team rebuilds), with no env/flag/request path to change it. Operators who want a different default visibility must fork and edit Go code — there is no switch either way. This PR adds that switch while keeping the existing default intact.What
templatesDefaultPublic()readsTEMPLATES_DEFAULT_PUBLIC(viastrconv.ParseBool; unset/empty/unparseable →false, i.e. private).template.RegisterBuild— the single funnel for the V1/V2/V3 create paths — after the rebuild-inheritance (data.Public = previous.Public), so the configured default governs both the persisted row (CreateOrUpdateTemplate) and theRegisterBuildResponse.Per-template overrides (request-body / API) could be layered on later; this PR only makes the default configurable.
Behavior
TEMPLATES_DEFAULT_PUBLICfalse/ invalidtrue/1Only affects newly created/rebuilt templates; existing templates are untouched. Default off → fully backward compatible.
Test
Added
TestTemplatesDefaultPubliccovering unset,true,1,false, empty, and garbage values.go build ./...and the test pass.