forked from slightlytyler/bluprint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread-config.js
36 lines (27 loc) · 804 Bytes
/
read-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = readConfig;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
// Example
//
// {
// "rootDirectory": "dummy/app",
// "podsDirectory": "pods",
// "blueprintsDirectory": "dummy/pods"
// }
function readConfig(__dir__, callback) {
var defaults = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
_fs2['default'].readFile(__dir__, 'utf8', function (err, data) {
if (err) {
callback(defaults);
} else {
var options = Object.assign(defaults, JSON.parse(data));
callback(options);
}
});
}
module.exports = exports['default'];