1 | var fs = require('fs');
|
2 | var path = require('path');
|
3 |
|
4 | exports.getStoredPath = function () {
|
5 | var root = process.env.PROJECT_HOME || process.cwd();
|
6 | return path.resolve(root, 'fbp-config.json');
|
7 | };
|
8 |
|
9 | exports.getStored = function () {
|
10 | var storedPath = exports.getStoredPath();
|
11 | if (!fs.existsSync(storedPath)) {
|
12 | throw new Error('Did not find ' + storedPath + '. Run fpb-init first to configure.');
|
13 | }
|
14 | return JSON.parse(fs.readFileSync(storedPath));
|
15 | };
|
16 |
|
17 | exports.saveStored = function (values) {
|
18 | var storedPath = exports.getStoredPath();
|
19 | fs.writeFileSync(storedPath, JSON.stringify(values, null, 2), 'utf-8');
|
20 | };
|