This commit is contained in:
William Bartholomew 2016-03-10 17:00:48 -08:00
Родитель 99ff3e85f3
Коммит 37548dba1a
2 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -1 +1,6 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
* ------------------------------------------------------------------------------------------ */
module.exports = require('./lib/painless-config');

Просмотреть файл

@ -1,3 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var fs = require('fs');
var process = require('process');
var walkBack = require('walk-back');
@ -5,7 +10,7 @@ var objectPath = require('object-path');
(function () {
var config = {};
var fallbacks = undefined;
var fallbackLocation = undefined;
@ -13,7 +18,7 @@ var objectPath = require('object-path');
if (fallbackLocation !== undefined) {
return;
}
fallbackLocation = walkBack(process.cwd(), 'env.json');
}
@ -21,17 +26,17 @@ var objectPath = require('object-path');
if (fallbacks !== undefined) {
return;
}
findFallbacks();
if (fallbackLocation === null) {
fallbacks = {};
return;
}
var fallbackData = fs.readFileSync(fallbackLocation, 'utf8');
fallbacks = JSON.parse(fallbackData);
}
function getEnvPath(env) {
return env.replace(/[_-]/g, '.');
}
@ -44,7 +49,7 @@ var objectPath = require('object-path');
}
return value;
};
config.all = function () {
loadFallbacks();
var all = {};
@ -62,6 +67,6 @@ var objectPath = require('object-path');
}
return all;
};
module.exports = config;
})();