Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return this.config.init( this.configFileName ).then(function( r ){
let options = r;
if (r.proxy) {
const proxiedRequest = request.defaults({ proxy: r.proxy });
options = Object.assign({}, r, { request: proxiedRequest });
}
// Connect to Jira
_self.api = new JiraApi( options );
});
}
this.ticketPromises = {};
const { host, username, password} = config.jira.api;
let { email, token } = config.jira.api;
if (!token && typeof password !== 'undefined') {
console.warn('WARNING: Jira password is deprecated. Use an API token instead.');
token = password
}
if (!email && typeof username !== 'undefined') {
console.warn('WARNING: Jira username is deprecated for API authentication. Use user email instead.');
email = username
}
if (config.jira.api.host) {
this.jira = new JiraApi({
host,
username: email,
password: token,
protocol: 'https',
apiVersion: 2,
strictSSL: true
});
} else {
console.error('ERROR: Cannot configure Jira without a host configuration.');
}
}
constructor(config) {
JiraService.validateConfig(config);
const { host, username, password } = config;
this.jira = new JiraApi({
protocol: 'https',
host,
username,
password,
apiVersion: '2',
strictSSL: true,
});
this.statusCategory = {
inProgress: ['In Progress', 'In Development'],
selectedForDev: ['Selected for Development'],
readyForQA: ['Ready for QA', 'Ready for QA (Stage)', 'Ready for QA (Testsystem)'],
};
}