Skip to content

Commit

Permalink
fix hard coding of agent
Browse files Browse the repository at this point in the history
  • Loading branch information
hsimah committed Jul 26, 2019
1 parent 1c6fb0e commit e987049
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 95 deletions.
9 changes: 6 additions & 3 deletions lib/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ function Metadata(url, authtype, options) {
this.metadata = null;
this.authtype = authtype;
this.loggingNoPII = options.loggingNoPII;
this.httpsProxyAgent = new HttpsProxyAgent(options.proxy);
if (options.proxy) {
// if user has specified proxy settings instantiate agent
this.httpsProxyAgent = new HttpsProxyAgent(options.proxy);
}
}

Object.defineProperty(Metadata, 'url', {
Expand Down Expand Up @@ -169,14 +172,14 @@ Metadata.prototype.generateOidcPEM = function generateOidcPEM(kid) {
else
throw new Error(`a key with kid %s cannot be found`, kid);
}

if (!pubKey) {
if (self.loggingNoPII)
throw new Error('generating public key pem failed');
else
throw new Error(`generating public key pem failed for kid: %s`, kid);
}

return pubKey;
};

Expand Down
Loading

0 comments on commit e987049

Please sign in to comment.