Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
method: 'POST',
uri: '',
json: true,
auth: {
bearer: ''
},
body: {}
};
_this.healthCheckerRecursiveTimeout = 1000 * 60 * 5; // 5 minutes
_this.healthCheckerResponseTimeout = 1000 * 20; // 20 seconds
_this.debug =
global.config.general &&
global.config.general.hasOwnProperty('runnerty.io') &&
global.config.general['runnerty.io'].hasOwnProperty('debug') &&
global.config.general['runnerty.io']['debug'] === true
? true
: false;
return new Promise(async resolve => {
if (
global.config.general &&
global.config.general.hasOwnProperty('runnerty.io') &&
global.config.general['runnerty.io'].hasOwnProperty('apikey') &&
global.config.general['runnerty.io']['apikey'] !== '' &&
!global.config.general['runnerty.io'].disable
) {
await _this.checkAccess();
}
resolve(_this);
});
constructor() {
let _this = this;
let protocol = 'https';
if (
global.config.general &&
global.config.general.hasOwnProperty('runnerty.io') &&
global.config.general['runnerty.io'].hasOwnProperty('protocol')
) {
protocol = global.config.general['runnerty.io']['protocol'];
}
_this.haveAccess = false;
_this.endpoints = {
chain: protocol + '://telemetry.runnerty.io/api/chainlog',
process: protocol + '://telemetry.runnerty.io/api/processlog',
access: protocol + '://telemetry.runnerty.io/api/checkaccess',
health: protocol + '://telemetry.runnerty.io/api/health',
dead: protocol + '://telemetry.runnerty.io/api/dead'
};
_this._values = {
headers: {
'User-Agent': 'runnerty',
'Content-Type': 'application/json'
},
return new Promise(resolve => {
let valuesSend = this._values;
valuesSend.auth.bearer = global.config.general['runnerty.io']['apikey'];
valuesSend.uri = this.endpoints.access;
valuesSend.body.version = global.version;
http(valuesSend)
.then(_ => {
logger.log('info', 'Successful access to runnerty.io');
this.haveAccess = true;
if (
global.config.general.hasOwnProperty('runnerty.io') &&
global.config.general['runnerty.io'].hasOwnProperty(
'healthChecker'
) &&
global.config.general['runnerty.io']['healthChecker'] === true
) {
this.healthCheckerRecursive();
}
.then(_ => {
logger.log('info', 'Successful access to runnerty.io');
this.haveAccess = true;
if (
global.config.general.hasOwnProperty('runnerty.io') &&
global.config.general['runnerty.io'].hasOwnProperty(
'healthChecker'
) &&
global.config.general['runnerty.io']['healthChecker'] === true
) {
this.healthCheckerRecursive();
}
resolve();
})
.catch(err => {
return new Promise(async resolve => {
if (
global.config.general &&
global.config.general.hasOwnProperty('runnerty.io') &&
global.config.general['runnerty.io'].hasOwnProperty('apikey') &&
global.config.general['runnerty.io']['apikey'] !== '' &&
!global.config.general['runnerty.io'].disable
) {
await _this.checkAccess();
}
resolve(_this);
});
}
constructor() {
let _this = this;
let protocol = 'https';
if (
global.config.general &&
global.config.general.hasOwnProperty('runnerty.io') &&
global.config.general['runnerty.io'].hasOwnProperty('protocol')
) {
protocol = global.config.general['runnerty.io']['protocol'];
}
_this.haveAccess = false;
_this.endpoints = {
chain: protocol + '://telemetry.runnerty.io/api/chainlog',
process: protocol + '://telemetry.runnerty.io/api/processlog',
access: protocol + '://telemetry.runnerty.io/api/checkaccess',
health: protocol + '://telemetry.runnerty.io/api/health',
dead: protocol + '://telemetry.runnerty.io/api/dead'
};
_this._values = {
headers: {
'User-Agent': 'runnerty',
'Content-Type': 'application/json'
},
method: 'POST',
uri: '',