Skip to content

Commit ba7c8c6

Browse files
committed
Cached registry value and restored environment variable check
1 parent e4d0dc8 commit ba7c8c6

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

lib/Constants.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ module.exports = {
1818
getRegistry:getRegistry
1919
};
2020

21+
var registry = null;
22+
2123
function searchForHome() {
2224
var locations = [
2325
process.env.HOME,
@@ -31,11 +33,21 @@ function searchForHome() {
3133
}
3234

3335
function getRegistry() {
34-
if (fs.existsSync('./.bowerrc')) {
36+
if (registry !== null) {
37+
return registry;
38+
}
39+
40+
if (process.env.ADAPT_REGISTRY) {
41+
registry = process.env.ADAPT_REGISTRY;
42+
43+
} else if (fs.existsSync('./.bowerrc')) {
3544
// a manifest exists; let bower determine the registry
36-
return;
45+
registry = undefined;
46+
47+
} else {
48+
// use the default Adapt registry
49+
registry = 'http://adapt-bower-repository.herokuapp.com/';
3750
}
3851

39-
// use the default Adapt registry
40-
return 'http://adapt-bower-repository.herokuapp.com/';
52+
return registry;
4153
}

0 commit comments

Comments
 (0)