Skip to content

Commit

Permalink
Enable debugging of *github* dep
Browse files Browse the repository at this point in the history
* Also at some point *node* changed the way to detect if debugging was in process. Updated original comment at OpenUserJS#429 (comment) Been a while since I've been in this mode for deep debug examination.
* Fix missing custom headers for UA. This is optional but didn't know this until now that it had that option for the *github* dep. Post OpenUserJS#1753

Applies to OpenUserJS#1705

Ref(s):
* https://nodejs.org/api/inspector.html#inspector_inspector_url
* https://nodejs.org/api/debugger.html
  • Loading branch information
Martii committed Apr 17, 2021
1 parent a303691 commit fea8c0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion libs/debug.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

var inspector = require('inspector');
var fs = require('fs');
var os = require('os');

Expand All @@ -10,7 +11,7 @@ pkg.org = pkg.name.substring(0, pkg.name.indexOf('.'));

var isPro = process.env.NODE_ENV === 'production';
var isDev = !isPro;
var isDbg = typeof v8debug === 'object';
var isDbg = typeof v8debug === 'object' || inspector.url();

var privkey = null;
var fullchain = null;
Expand Down
6 changes: 5 additions & 1 deletion libs/githubClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ var createOAuthAppAuth = require("@octokit/auth-oauth-app").createOAuthAppAuth;

// Client
var github = new GitHubApi({
version: "3.0.0"
version: "3.0.0",
debug: (isDbg ? true : false),
headers: {
"User-Agent": uaOUJS + (process.env.UA_SECRET ? ' ' + process.env.UA_SECRET : '')
}
});
module.exports = github;

Expand Down

0 comments on commit fea8c0b

Please sign in to comment.