From b727cb007ab0734d977d4aa49c49093b7fe2f285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Sko=C5=99epa?= <jakub@skorepa.info> Date: Fri, 15 Apr 2016 23:06:48 +0200 Subject: [PATCH] Dont make config.toml mandatory Fixes #38 --- sitegin/config.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sitegin/config.js b/sitegin/config.js index 1a6de2ce..aea78ef4 100644 --- a/sitegin/config.js +++ b/sitegin/config.js @@ -45,9 +45,13 @@ module.exports = function() { }; var configFile = path.join(config.sourceDir, 'config.toml'); fs.readFile(configFile,'utf-8',function(err,data) { - if(err) return reject('Error reading '+configFile); + if(err) { + console.log('Failed to read configuration from '+configFile); + console.log('Using defaults') + return resolve({config: config}); + } data = toml.parse(data); - console.log(data); + console.log('data: '+data); for(let attr in config) { data[attr] = config[attr]; } resolve({config: data}); }) -- GitLab