-
Notifications
You must be signed in to change notification settings - Fork 2
/
about.js
47 lines (40 loc) · 1.44 KB
/
about.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const axios = require('axios');
const path = require('path');
const { logger, execPath } = require('../../globals');
const { setupQRSConnection } = require('./qrs');
function getAboutFromQseow(options) {
return new Promise((resolve, reject) => {
logger.verbose(`Getting about info from QSEoW...`);
// Make sure certificates exist
const fileCert = path.resolve(execPath, options.authCertFile);
const fileCertKey = path.resolve(execPath, options.authCertKeyFile);
const axiosConfig = setupQRSConnection(options, {
method: 'get',
fileCert,
fileCertKey,
path: '/qrs/about',
// headers: {
// 'Accept': 'application/json',
// 'Content-Type': 'application/json; charset=utf-8',
// },
});
logger.debug(`About to get about info from QSEoW`);
axios
.request(axiosConfig)
.then((result) => {
if (result.status === 200) {
const response = JSON.parse(result.data);
logger.debug(`Successfully retrieved about info from QSEoW`);
// Yes, the tag exists
resolve(response);
}
resolve(false);
})
.catch((err) => {
logger.error(`GET ABOUT INFO: ${err}`);
});
});
}
module.exports = {
getAboutFromQseow,
};