You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support environment variable placeholders in config and data files - #2031
Adds environment variable placeholders to Dev Proxy config files and plugin data files.
${VAR} (and ${env:VAR} alias) resolved at file load, per string value (property names untouched)
Config files resolve against --env, the config env section, then OS environment
Unset variables: placeholder left as-is with a warning
$${VAR} escapes a literal ${VAR}
Legacy @VAR (API Center) and {VAR} (minimal permissions API specs) still work but log deprecation warnings
Notes for review:
Rewrites files opt out of load-time resolution because ${name} is a regex capture-group reference in rewrite targets; they keep the existing per-request ${env:NAME} handling
Not covered: .http mocks, @file bodies, prompt files; config validate and plugin-config schema validation still see raw text
Tests added for the resolver, config providers and BaseLoader. Docs (skills references) and v4 rc schema env description updated.
…losesdotnet#1667
Resolve ${VAR} (and ${env:VAR}) placeholders when loading Dev Proxy config
files and plugin data files. Unset variables are left as-is with a warning;
$${VAR} escapes a literal placeholder. Legacy @var (API Center) and {VAR}
(minimal permissions API specs) keep working but log deprecation warnings.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved findings show placeholder resolution can corrupt YAML and mishandle escaped or Unicode-encoded tokens, while case-variant CLI overrides can cause Windows startup failures.
Adds environment-variable placeholders to Dev Proxy configuration and plugin data files, addressing #1667 by reducing the need for scripts that rewrite environment-specific values.
Changes:
Adds shared placeholder resolution, escaping, precedence rules, and unresolved-variable warnings.
Integrates resolution into configuration providers and plugin loaders, preserves RewritePlugin handling, and warns on legacy syntax.
Adds resolver and loader tests, updates examples, and documents supported behavior.
File
Description
skills/dev-proxy/references/configuration.md
Documents syntax, precedence, escaping, and exceptions.
- Don't throw on --env names differing only in casing on Windows
- Resolve JSON values containing Unicode-escaped placeholders
- Resolve YAML API specs per scalar value instead of raw text
- Apply legacy {NAME} variables only outside ${NAME} placeholders
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Exclude RewritePlugin inline rewrite rules from load-time placeholder
resolution, matching rewrites files
- Replace legacy {NAME} variables in YAML API specs in raw text (outside
${NAME} placeholders) so unquoted values keep working
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Rewrite exclusions are computed before plugin metadata is expanded: with SECTION=myRewrites and USER=alice, "configSection": "${SECTION}" causes an inline /users/${USER} target to become /users/alice, losing its capture-group reference. A placeholder in the plugin name also bypasses the exclusion. Compute the prefixes from resolved metadata, while preserving single-pass expansion of the stored values.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Rewrite exclusions are computed before plugin metadata expansion, allowing environment-variable substitution to alter inline rewrite targets and capture-group references when plugin names or section references contain placeholders.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because YAML alias mutation can alter mapping keys, while placeholder matching can silently skip valid Windows environment-variable names.
${env:NAME} now matches any characters except } so names like
ProgramFiles(x86) resolve. Bare ${NAME} stays identifier-only. Pin
YAML alias-as-key behavior with a test.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Addressing the latest Copilot review summary (no inline threads) in 596a102:
Windows variable names skipped: fixed. ${env:NAME} now accepts any characters except }, so ${env:ProgramFiles(x86)}, ${env:FOO-BAR}, and ${env:FOO.BAR} resolve, and unset ones log a warning. Bare ${NAME} stays identifier-only on purpose so that unrelated ${...} text in data files isn't treated as a variable. Added tests covering $$ escaping and legacy {NAME} handling alongside the new names.
YAML alias used as a mapping key gets mutated: pushing back. An alias reuses the anchored node, so a key that aliases a resolved value changes with it. This is very unlikely in Dev Proxy configs and data files. Added a test that pins this behavior so it's intentional.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because legacy JSON-key substitution changes can report permissions for unrelated paths, while startup failures can suppress missing-variable diagnostics.
…startup failure
- Replace legacy {NAME} variables in raw text for JSON API specs too, so
keys like OpenAPI paths keep being substituted as before
- Write unresolved placeholder warnings to stderr when startup fails
before the logger is available
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Addressing the latest Copilot review summary (no inline threads):
Legacy JSON key substitution: fixed in e890062. Before this PR, legacy {NAME} variables were replaced in the raw text of JSON specs, including keys such as OpenAPI paths. The JSON pass only looked at values, which broke that. Both JSON and YAML specs now apply the legacy replacement to the raw text again, skipping only ${...} placeholders, and then resolve new-style placeholders in values. Added a test.
Startup failures hide missing-variable warnings: fixed in e890062. If building the app throws, for example on an invalid apiPort: "${API_PORT}", the unresolved-variable warnings are now written to stderr before the exception propagates. In JSON output mode they're written as JSONL. Verified manually.
Also in c6e03d6: restored the original CRLF line endings in files that had been accidentally converted to LF, so the PR diff only shows real changes.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues are recorded for the environment-variable placeholder changes.
No open issues 🎉
Review effort: Balanced
This branch has not been deployed
No deployments
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
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.
Closes #1667
Adds environment variable placeholders to Dev Proxy config files and plugin data files.
${VAR}(and${env:VAR}alias) resolved at file load, per string value (property names untouched)--env, the configenvsection, then OS environment$${VAR}escapes a literal${VAR}@VAR(API Center) and{VAR}(minimal permissions API specs) still work but log deprecation warningsNotes for review:
${name}is a regex capture-group reference in rewrite targets; they keep the existing per-request${env:NAME}handling.httpmocks,@filebodies, prompt files;config validateand plugin-config schema validation still see raw textTests added for the resolver, config providers and BaseLoader. Docs (skills references) and v4 rc schema
envdescription updated.