mirror of
https://github.com/harish2704/npm-offline-registry.git
synced 2026-09-10 06:21:09 +00:00
Merge pull request #3 from 1stvamp/allow-local_register-overriding-from-env
Allow LOCAL_REGISTRY to be set from env
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user