From 3c07d89ce380464a3aedc830ad468444cd3fe164 Mon Sep 17 00:00:00 2001 From: "Juan Picado @jotadeveloper" Date: Mon, 19 Jun 2017 20:45:09 +0200 Subject: [PATCH] Fix #78 Add new setting to allow publish when uplinks are offline --- conf/full.yaml | 5 +++++ src/lib/storage.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/conf/full.yaml b/conf/full.yaml index 7700da2ad54f1..8173528b7215f 100644 --- a/conf/full.yaml +++ b/conf/full.yaml @@ -92,6 +92,11 @@ packages: # Advanced settings ##################################################################### +## Special packages publish configurations +#publish: +## This will allow the publisher to publish packages even if any uplink is down. +# allow_offline: true + # if you use nginx with custom path, use this to override links #url_prefix: https://dev.company.local/verdaccio/ diff --git a/src/lib/storage.js b/src/lib/storage.js index 5b5aa0c5b831b..22598cdf0bdca 100644 --- a/src/lib/storage.js +++ b/src/lib/storage.js @@ -83,6 +83,9 @@ class Storage { // if uplink fails with a status other than 404, we report failure if (_.isNil(err_results[i][0]) === false) { if (err_results[i][0].status !== 404) { + if (_.isNil(this.config.publish) === false && this.config.publish.allow_offline) { + return resolve(); + } return reject(Error[503]('one of the uplinks is down, refuse to publish')); } }