Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/common/variables/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function parseEnvLine(line: string): [string, string] {
// https://github.com/motdotla/dotenv/blob/master/lib/main.js#L32
// We don't use dotenv here because it loses ordering, which is
// significant for substitution.
const match = line.match(/^\s*([a-zA-Z]\w*)\s*=\s*(.*?)?\s*$/);
const match = line.match(/^\s*(_*[a-zA-Z]\w*)\s*=\s*(.*?)?\s*$/);
if (!match) {
return ['', ''];
}
Expand Down
5 changes: 3 additions & 2 deletions src/test/common/variables/envVarsService.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,23 +395,24 @@ Path=/usr/x:/usr/y
SPAM=1234
ham=5678
Eggs=9012
_bogus1=...
1bogus2=...
bogus 3=...
bogus.4=...
bogus-5=...
bogus~6=...
VAR1=3456
VAR_2=7890
_VAR_3=1234
`);

expect(vars).to.not.equal(undefined, 'Variables is undefiend');
expect(Object.keys(vars!)).lengthOf(5, 'Incorrect number of variables');
expect(Object.keys(vars!)).lengthOf(6, 'Incorrect number of variables');
expect(vars).to.have.property('SPAM', '1234', 'value is invalid');
expect(vars).to.have.property('ham', '5678', 'value is invalid');
expect(vars).to.have.property('Eggs', '9012', 'value is invalid');
expect(vars).to.have.property('VAR1', '3456', 'value is invalid');
expect(vars).to.have.property('VAR_2', '7890', 'value is invalid');
expect(vars).to.have.property('_VAR_3', '1234', 'value is invalid');
});

test('Empty values become empty string', () => {
Expand Down