Add license header
This commit is contained in:
Родитель
99ff3e85f3
Коммит
37548dba1a
5
index.js
5
index.js
|
@ -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;
|
||||
})();
|
Загрузка…
Ссылка в новой задаче