Skip to content

Commit df44ccc

Browse files
Templumlpsimon
andauthored
🐛 Fixing issue with debug logs (#221)
* ✏️ Fixed Typo * 👽 Adjusted CSDS to match latest state * 🐛 Fixed debug logs * 🔧 Removed outdated Node Version * ♻️ adjusted csds for cli itself --------- Co-authored-by: spelczer <[email protected]>
1 parent 67c601c commit df44ccc

File tree

5 files changed

+15
-21
lines changed

5 files changed

+15
-21
lines changed

.github/workflows/testBranch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
# run on all supported LTS versions and the latest/current version
19-
node-version: [14, 16, 18, latest]
19+
node-version: [18, latest]
2020

2121
steps:
2222
- uses: actions/checkout@v3

bin/example/bin/rewire.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ function isLoggableError(error) {
7171

7272
class Logger {
7373
constructor(debug) {
74-
this.debug = debug;
74+
this.isDebugMode = debug;
7575
this.history = [];
7676
}
7777

7878
writeLogs(level, message, ...optionalParams) {
79-
// if (!this.isDebugMode && level === LogLevels.Debug) return;
80-
if (this.debug) {
79+
80+
if (this.isDebugMode) {
8181
if (Object.hasOwnProperty.call(message, 'errorMsg')) {
8282
stdout.log(`[${level}] - ${message.errorMsg}`, ...optionalParams);
8383
} else if (hasOptionals(optionalParams)) {

src/service/csds.service.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,18 @@ export class CsdsClient {
8080
}
8181

8282
private getUrl(): string {
83-
return `http://${this.getCsdsDomain()}/api/account/${
83+
return `https://${this.getCsdsDomain()}/api/account/${
8484
this.accountId
8585
}/service/baseURI.json?version=1.0`;
8686
}
8787

8888
private getCsdsDomain(): string {
89-
if (this.accountId.startsWith('le') || this.accountId.startsWith('qa')) {
90-
return 'hc1n.dev.lprnd.net';
89+
if (this.accountId?.startsWith('le') || this.accountId?.startsWith('qa')) {
90+
return 'lp-csds-qa.dev.lprnd.net';
9191
}
92-
if (this.accountId.startsWith('fr')) {
92+
if (this.accountId?.startsWith('fr')) {
9393
return 'adminlogin-z0-intg.liveperson.net';
9494
}
95-
// alpha/production
96-
return 'adminlogin.liveperson.net';
95+
return 'api.liveperson.net';
9796
}
9897
}

src/shared/faas-debugger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export class FaasDebugger {
247247
/* eslint-enable */
248248
this.port = await getPort({ port: getPort.makeRange(30500, 31000) });
249249
}
250-
this.udpatePortForFiles();
250+
this.updatePortForFiles();
251251
const args = [
252252
`--inspect-brk=${this.port}`,
253253
join(this.functionPath, 'index.js'),
@@ -392,7 +392,7 @@ ${originalCode}
392392
writeFileSync(filePath, content);
393393
}
394394

395-
private udpatePortForFiles() {
395+
private updatePortForFiles() {
396396
/* istanbul ignore else */
397397
if (existsSync(join(this.cwd, '.vscode', 'launch.json'))) {
398398
this.updatePort(join(this.cwd, '.vscode', 'launch.json'));

src/shared/lp-faas-toolbelt/csds-client/csdsClient.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,12 @@ export class CsdsClient implements ICsdsClient {
8383
}
8484

8585
private getUrl(): string {
86-
return `http://${this.getCsdsDomain()}/api/account/${
86+
return `https://${this.getCsdsDomain()}/api/account/${
8787
this.accountId
8888
}/service/baseURI.json?version=1.0`;
8989
}
9090

9191
private getCsdsDomain(): string {
92-
return process.env.CSDS_DOMAIN
93-
? process.env.CSDS_DOMAIN
94-
: this.deriveCsdsDomainFromAccountId();
95-
}
96-
97-
private deriveCsdsDomainFromAccountId(): string {
9892
if (this.accountId?.startsWith('le') || this.accountId?.startsWith('qa')) {
9993
return 'lp-csds-qa.dev.lprnd.net';
10094
}
@@ -103,6 +97,7 @@ export class CsdsClient implements ICsdsClient {
10397
}
10498
return 'api.liveperson.net';
10599
}
100+
106101
}
107102

108103
async function getAccountId() {
@@ -124,7 +119,7 @@ async function getAccountId() {
124119
}
125120
}
126121

127-
async function getCrpytoConfig(): Promise<{
122+
async function getCryptoConfig(): Promise<{
128123
algorithm: string;
129124
key: Buffer;
130125
iv: string;
@@ -145,7 +140,7 @@ async function getCrpytoConfig(): Promise<{
145140
}
146141

147142
async function decrypt(data: any) {
148-
const { algorithm, key, iv } = await getCrpytoConfig();
143+
const { algorithm, key, iv } = await getCryptoConfig();
149144
const decipher = crypto.createDecipheriv(algorithm, key, iv);
150145
let decrypted = decipher.update(data, 'hex', 'utf8');
151146
decrypted += decipher.final('utf8');

0 commit comments

Comments
 (0)