Skip to content

Commit

Permalink
config.json instead of config.js
Browse files Browse the repository at this point in the history
closes #345
  • Loading branch information
andrewrk committed Oct 6, 2014
1 parent cc824ff commit 56a9d75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,6 +1,6 @@
/node_modules
/groovebasin.db
/config.js
/config.json

# not shared with .npmignore
/public/app.js
Expand Down
6 changes: 3 additions & 3 deletions lib/groovebasin.js
Expand Up @@ -60,23 +60,23 @@ GrooveBasin.prototype.initConfigVar = function(name, defaultValue) {

GrooveBasin.prototype.loadConfig = function(cb) {
var self = this;
var pathToConfig = "config.js";
var pathToConfig = "config.json";
fs.readFile(pathToConfig, {encoding: 'utf8'}, function(err, contents) {
var anythingAdded = false;
var config;
if (err) {
if (err.code === 'ENOENT') {
anythingAdded = true;
self.config = defaultConfig;
log.warn("No config.js found; writing default.");
log.warn("No " + pathToConfig + " found; writing default.");
} else {
return cb(err);
}
} else {
try {
self.config = JSON.parse(contents);
} catch (err) {
cb(err);
cb(new Error("Unable to parse " + pathToConfig + ": " + err.message));
return;
}
}
Expand Down

0 comments on commit 56a9d75

Please sign in to comment.