feat(settings): add settings.env field for environment variable configuration - #1751
Merged
Conversation
…guration Add support for defining environment variables in settings.json files. These variables are loaded with the lowest priority: 1. System/process environment variables (highest) 2. .env files 3. settings.env (lowest/fallback) This allows users to configure default environment variables in their user or workspace settings without conflicting with existing env vars or .env file values. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
tanzhenxin
requested review from
DennisYu07,
LaZzyMan,
Mingholy,
gwinthis and
pomelo-nwu
as code owners
February 8, 2026 01:35
Contributor
📋 Review SummaryThis PR introduces a new 🔍 General Feedback
🎯 Specific Feedback🟢 Medium
🔵 Low
✅ Highlights
|
Update the header info panel hint from '/auth to change' to '/model to change' to better reflect that this command switches models rather than authentication. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
…tomHeaders Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
feat(settings): add settings.env field for environment variable configuration
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.
TLDR
This PR adds a new
settings.envfield to the settings schema, allowing users to define environment variables directly in theirsettings.jsonfiles. These variables act as fallback defaults with the lowest priority in the environment variable resolution order.Dive Deeper
Currently, users can configure environment variables through:
.envfiles in the project rootThis change introduces a third option -
settings.env- which provides the lowest priority. This is useful for:.envvaluesPriority order (highest to lowest):
process.env(system/export/inline).envfiles (no-override mode)settings.env(no-override mode)The
settings.envfield accepts a simple key-value object where both keys and values are strings. It supports both user-level (~/.qwen/settings.json) and workspace-level (.qwen/settings.json) configurations, with values being shallow-merged.Reviewer Test Plan
To validate this change:
npm run build~/.qwen/settings.json:{ "env": { "MY_TEST_VAR": "from_settings" } }.envfile -.envshould wincd packages/cli && npx vitest run src/config/settings.test.tsTesting Matrix
Tested on macOS - Build passes and new unit tests pass
Linked issues / bugs
No linked issues
🤖 Generated with Qwen Code