-
-
Notifications
You must be signed in to change notification settings - Fork 66
Sync dev to main #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync dev to main #129
Conversation
tis24dev
commented
Feb 2, 2026
- Add --upgrade-config-json and auto-config upgrade
- Refine upgrade prompts, previews, and errors
Introduce a machine-readable config-upgrade mode (--upgrade-config-json) and wire automatic configuration upgrades into the binary upgrade flow. The upgrade command now attempts to run the newly installed binary to merge template changes into backup.env (adding missing keys while preserving existing values). Implemented robust parsing and rendering for multi-line (block) env values, refactored value parsing into helpers (parseEnvValues, splitKeyValueRaw, renderEnvValue, findClosingQuoteLine) and updated computeConfigUpgrade to preserve block entries and multiple values per key. Added tests covering block preservation and missing-block detection. printUpgradeFooter now reports detailed config-upgrade results or errors, and installer/help text was updated to reflect the behavior change. Error handling for the JSON mode and subprocess invocation was added to ensure clear diagnostics.
Make the upgrade UX and diagnostics clearer: update the interactive prompt to inform users a backup will be created and backup.env may be updated; extract maxUpgradeConfigJSONPreviewLength constant and use it when truncating invalid JSON preview. Improve error messages to include the config path when parsing fails and the starting line number for unterminated multi-line values. Update tests to normalize CRLF vs LF so assertions are deterministic across platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds automatic configuration upgrade functionality during binary upgrades and introduces a new --upgrade-config-json flag for internal use. The upgrade process now automatically adds missing keys from the new template to backup.env while preserving existing values, and creates a backup before making changes.
Changes:
- Added
--upgrade-config-jsonflag for JSON-formatted upgrade output (internal use by--upgrade) - Enhanced upgrade workflow to automatically upgrade configuration files using the newly installed binary
- Implemented support for multi-line block values in environment configuration files
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/config/upgrade.go | Added block value parsing and rendering for multi-line configuration values |
| internal/config/upgrade_test.go | Added tests for block value preservation and missing block key tracking |
| internal/cli/args.go | Added UpgradeConfigJSON flag and updated --upgrade description |
| cmd/proxsave/upgrade.go | Implemented automatic config upgrade during binary upgrade with detailed user feedback |
| cmd/proxsave/main.go | Added --upgrade-config-json command handling and updated help text |
| cmd/proxsave/install.go | Updated --upgrade help text to reflect automatic config upgrade behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| continue | ||
| } | ||
|
|
||
| if blockValueKeys[key] && trimmed == fmt.Sprintf("%s=\"", key) { |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable blockValueKeys is referenced but never defined or imported in this file. This will cause a compilation error unless blockValueKeys is defined elsewhere in the codebase that isn't shown in the diff.
| if blockValueKeys[key] && trimmed == fmt.Sprintf("%s=\"", key) { | |
| if trimmed == fmt.Sprintf("%s=\"", key) { |
|
|
||
| templateKeys[key] = true | ||
|
|
||
| if blockValueKeys[key] && trimmed == fmt.Sprintf("%s=\"", key) { |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable blockValueKeys is referenced but never defined or imported in this file. This will cause a compilation error unless blockValueKeys is defined elsewhere in the codebase that isn't shown in the diff.
| if blockValueKeys[key] && trimmed == fmt.Sprintf("%s=\"", key) { | |
| if trimmed == fmt.Sprintf("%s=\"", key) { |