fix(samples): exclude auto-populated Defang vars from detected sample configs - #407
Merged
Merged
Conversation
… configs prep-samples.js records the env vars a sample needs as config into samples-v2.json (consumed by the website). COMPOSE_PROJECT_NAME, DEFANG_PROVIDER and DEFANG_STACK are populated automatically by compose-go/Defang, so drop them from each sample's detected configs. Mirrors the CLI's reservedConfigNames (DefangLabs/defang src/pkg/cli/compose/validation.go). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lionello
approved these changes
Jul 28, 2026
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.
What
Drop the auto-populated variables
COMPOSE_PROJECT_NAME,DEFANG_PROVIDER, andDEFANG_STACKfrom each sample's detectedconfigsinscripts/prep-samples.js.Why
prep-samples.jsparses every sample'scompose.yamland records the env vars a developer must set as config intostatic/samples-v2.json(consumed by the sample pages on the website). These three are populated automatically by compose-go/Defang, so listing them as "configs to set" is noise. Notablyself-improving-mastrauses${DEFANG_STACK}/${DEFANG_PROVIDER}, which the script currently surfaces.How
Added a
RESERVED_CONFIG_VARSset and delete those names from each sample'sconfigsbefore emitting. Covers both env forms (list- VAR, mapVAR:) and${...}interpolation references, since all feed the sameconfigsset. Mirrors the CLI's canonicalreservedConfigNames(DefangLabs/defangsrc/pkg/cli/compose/validation.go).Verification
Ran the real
prep-samples.jsagainst a fixture sample declaring all three reserved vars (bare key, map form, and via${...}) plus genuine secrets; the emittedconfigscontained only the genuine secrets. (This repo has no JS test runner forscripts/, so no unit-test harness was added.)Part of a 3-repo change (also DefangLabs/defang and DefangLabs/portal).
🤖 Generated with Claude Code