Skip to content

Conversation

@sjinks
Copy link
Member

@sjinks sjinks commented Oct 29, 2025

Description

vip dev-env envvar commands incorrectly display values containing the equal sign. This happens because the equal sign splits the key-value line, and split() in JavaScript behaves differently than in PHP ('x=a=b'.split( '=', 2 ) will split the entire line by =, but will return only the first two items; while PHP in this case will split the line by the first =).

This PR fixes that.

Changelog Description

Fixed

  • vip dev-env envvar commands now correctly display values with embedded equal signs.

Pull request checklist

New release checklist

Steps to Test

  1. vip dev-env envvar set X 123==
  2. vip dev-env envvar get-all

Without this patch, the result will be

┌──────┬───────┐
│ name │ value │
├──────┼───────┤
│ X    │ "123  │
└──────┴───────┘

With this patch,

┌──────┬───────┐
│ name │ value │
├──────┼───────┤
│ X    │ 123== │
└──────┴───────┘

@sjinks sjinks self-assigned this Oct 29, 2025
@github-actions
Copy link
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@sonarqubecloud
Copy link

@sjinks sjinks marked this pull request as ready for review October 29, 2025 05:59
@sjinks sjinks requested a review from Copilot October 29, 2025 05:59
Copy link
Contributor

Copilot AI left a 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 refactors the environment variable parsing logic by introducing a new splitKeyValueString utility function to replace inline split('=', 2) calls across multiple files. This improves code reusability and ensures consistent handling of key-value pairs in environment variable files.

  • Introduced a new utility function splitKeyValueString in src/lib/utils.ts that handles splitting key-value strings with proper trimming
  • Replaced all inline split('=', 2) calls with the new utility function across 5 command files
  • Added comprehensive unit tests for the new utility function covering various edge cases

Reviewed Changes

Copilot reviewed 2 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/lib/utils.ts Added splitKeyValueString utility function to parse key-value strings with configurable delimiter
src/bin/vip-dev-env-envvar-set.js Updated to use splitKeyValueString instead of inline split
src/bin/vip-dev-env-envvar-list.js Updated to use splitKeyValueString instead of inline split
src/bin/vip-dev-env-envvar-get.js Updated to use splitKeyValueString instead of inline split
src/bin/vip-dev-env-envvar-get-all.js Updated to use splitKeyValueString instead of inline split
src/bin/vip-dev-env-envvar-delete.js Updated to use splitKeyValueString instead of inline split
tests/lib/utils.js Added unit tests for splitKeyValueString function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sjinks sjinks requested a review from a team October 29, 2025 06:10
@sjinks sjinks merged commit 5dbe124 into trunk Oct 29, 2025
25 checks passed
@sjinks sjinks deleted the pltfrm-1816-env-vars-being-truncated-in-dev-env branch October 29, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants