diff --git a/bin/www b/bin/www index 0961fde..2e396b5 100755 --- a/bin/www +++ b/bin/www @@ -82,5 +82,5 @@ function onError(error) { */ function onListening() { - console.log('Listening on http://' + config.LOCAL_REGISTRY ); + console.log('Listening on http://0.0.0.0:' + port ); } diff --git a/config.js b/config.js index 141223a..496ca3d 100644 --- a/config.js +++ b/config.js @@ -13,7 +13,10 @@ Object.keys( defaultConfig ).forEach( function(v){ }); -config.LOCAL_REGISTRY = 'localhost:' + config.PORT; +if( !config.LOCAL_REGISTRY ){ + config.LOCAL_REGISTRY = 'http://localhost:' + config.PORT; +} + if( config.ENABLE_NPM_FAILOVER == 'false' ){ config.ENABLE_NPM_FAILOVER = false; } diff --git a/utils.js b/utils.js index 634e053..c4d7491 100644 --- a/utils.js +++ b/utils.js @@ -29,7 +29,11 @@ exports.readFile = readFile; exports.patchData = function ( data ){ Object.keys(data.versions).forEach( function( v ){ var val = data.versions[v]; - val.dist.tarball = val.dist.tarball.replace( REGISTRY_NAME, LOCAL_REGISTRY ); + var protocal = 'http://'; + if( val.dist.tarball.indexOf( 'https:' ) !== false ){ + protocal = 'https://'; + } + val.dist.tarball = val.dist.tarball.replace( protocal + REGISTRY_NAME, LOCAL_REGISTRY ); }); };