cacert-boardvoting/ui/semantic/tasks/config/admin/github.js
Jan Dittberner d7a742d97d Update UI framework
- add package.json for npm/npx
- update to fomantic-ui
- move ui files to ui directory
- add UI build documentation to README.md
- add ui target to Makefile
- add addPrefix handler in boardvoting.go to allow the same /static/
  prefix for static resources
2022-05-08 16:13:50 +02:00

37 lines
729 B
JavaScript

/*******************************
GitHub Login
*******************************/
/*
Logs into GitHub using OAuth
*/
var
fs = require('fs'),
path = require('path'),
githubAPI = require('@octokit/rest'),
// stores oauth info for GitHub API
oAuthConfig = path.join(__dirname, 'oauth.js'),
oAuth = fs.existsSync(oAuthConfig)
? require(oAuthConfig)
: false,
github
;
if(!oAuth) {
console.error('Must add oauth token for GitHub in tasks/config/admin/oauth.js');
}
github = new githubAPI({
version : '3.0.0',
debug : true,
protocol : 'https',
timeout : 5000
});
github.authenticate({
type: 'oauth',
token: oAuth.token
});
module.exports = github;