()
| 105 | } |
| 106 | |
| 107 | function getConfig() { |
| 108 | return fs.readFileAsync(defaults.CONFIG_NAME) |
| 109 | .then(JSON.parse) |
| 110 | .catch(SyntaxError, function(err) { |
| 111 | console.log('Error parsing config'.red); |
| 112 | throw err; |
| 113 | }) |
| 114 | .error(function(err) { |
| 115 | console.log('Config does not exist'.red); |
| 116 | throw err; |
| 117 | }); |
| 118 | } |
| 119 | |
| 120 | function setConfig(config) { |
| 121 | return fs.writeFileAsync(defaults.CONFIG_NAME, JSON.stringify(config, "", 2)) |