Skip to content

Commit

Permalink
#34408: Unsetting environment variables a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
janssen-tiobe committed Jun 11, 2024
1 parent b8dfd10 commit 17df77b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1308,14 +1308,12 @@ class TicsConfiguration {
setVariables() {
// variable set to replace the loading bar with synchronising... in the install script
(0, environment_1.setVariable)('TICSCI', '1');
logger_1.logger.info(process.env.TICSIDE || "TICSIDE not found");
if (this.mode === Mode.CLIENT || this.mode === Mode.DIAGNOSTIC) {
(0, environment_1.setVariable)('TICSIDE', 'GITHUB');
}
else if (process.env.TICSIDE) {
(0, environment_1.unsetVariable)('TICSIDE');
}
logger_1.logger.info(process.env.TICSIDE || "TICSIDE not found");
// set ticsAuthToken
if (this.ticsAuthToken) {
(0, environment_1.setVariable)('TICSAUTHTOKEN', this.ticsAuthToken);
Expand Down Expand Up @@ -1859,7 +1857,7 @@ function setVariable(key, value) {
}
exports.setVariable = setVariable;
function unsetVariable(key) {
delete process.env[key];
process.env[key] = '';
}
exports.unsetVariable = unsetVariable;

Expand Down
2 changes: 0 additions & 2 deletions src/configuration/tics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,11 @@ export class TicsConfiguration {
// variable set to replace the loading bar with synchronising... in the install script
setVariable('TICSCI', '1');

logger.info(process.env.TICSIDE || "TICSIDE not found")
if (this.mode === Mode.CLIENT || this.mode === Mode.DIAGNOSTIC) {
setVariable('TICSIDE', 'GITHUB');
} else if (process.env.TICSIDE) {
unsetVariable('TICSIDE')
}
logger.info(process.env.TICSIDE || "TICSIDE not found")

// set ticsAuthToken
if (this.ticsAuthToken) {
Expand Down
2 changes: 1 addition & 1 deletion src/helper/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export function setVariable(key: string, value: string): void {
}

export function unsetVariable(key: string): void {
delete process.env[key];
process.env[key] = '';
}

0 comments on commit 17df77b

Please sign in to comment.