const AssetsPlugin = require('assets-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
-const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin')
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
"devDependencies": {
"add-asset-html-webpack-plugin": "^1.0.2",
"codelyzer": "^2.0.0",
- "standard": "^9.0.0",
+ "standard": "^10.0.0",
"webpack-bundle-analyzer": "^2.2.1",
"webpack-dll-bundles-plugin": "^1.0.0-beta.5"
}
"password-generator": "^2.0.2",
"pg": "^6.1.0",
"pg-hstore": "^2.3.2",
- "request": "^2.57.0",
+ "request": "^2.81.0",
"request-replay": "^1.0.2",
"rimraf": "^2.5.4",
"safe-buffer": "^5.0.1",
"chai": "^3.3.0",
"commander": "^2.9.0",
"mocha": "^3.0.1",
- "standard": "^9.0.0",
+ "standard": "^10.0.0",
"supertest": "^3.0.0",
"webtorrent": "^0.98.0"
},
}
function createCertsIfNotExist (callback) {
- certsExist(function (exist) {
+ certsExist(function (err, exist) {
+ if (err) return callback(err)
+
if (exist === true) {
return callback(null)
}
function certsExist (callback) {
const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME)
- fs.exists(certPath, function (exists) {
- return callback(exists)
+ fs.access(certPath, function (err) {
+ // If there is an error the certificates do not exist
+ const exists = !err
+ return callback(null, exists)
})
}
function createCerts (callback) {
- certsExist(function (exist) {
+ certsExist(function (err, exist) {
+ if (err) return callback(err)
+
if (exist === true) {
const string = 'Certs already exist.'
logger.warning(string)
err = err ? err.message : 'Status code not 20x : ' + res.statusCode
logger.error('Error sending secure request to %s pod.', toPod.host, { error: err })
- return callback(false)
+ return callback(err)
}
- return callback(true)
+ return callback(null)
})
}
const requestToMake = requestsToMakeGrouped[hashKey]
const toPod = requestToMake.toPod
- this.makeRequest(toPod, requestToMake.endpoint, requestToMake.datas, (success) => {
- if (success === false) {
+ this.makeRequest(toPod, requestToMake.endpoint, requestToMake.datas, (err) => {
+ if (err) {
badPods.push(requestToMake.toPod.id)
return callbackEach()
}
checking = true
const waitingInterval = setInterval(function () {
- isThereAwaitingRequests(servers, function (res) {
+ isThereAwaitingRequests(servers, function (err, res) {
+ if (err) throw err
+
if (res === true) {
console.log('A server has awaiting requests, waiting...')
return
}, function (err) {
if (err) throw err
- return callback(noRequests === false)
+ return callback(null, noRequests === false)
})
}