Skip to content

Commit e961053

Browse files
committed
better install script
1 parent f97f9c7 commit e961053

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

install.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
var MongoClient = require('mongodb').MongoClient,
22
ObjectId = require('mongodb').ObjectID,
3-
config = require('./config');
3+
fs = require('fs');
44

55
console.log('Running install script.');
66

7+
try {
8+
fs.statSync('./config').isFile();
9+
} catch (err) {
10+
console.log('ERROR: config.js missing!');
11+
process.exit(1);
12+
}
13+
14+
var config = require('./config');
15+
716
var insertUser = function(db, callback) {
817
db.collection('users').insertOne({
918
'auth': {
@@ -45,4 +54,4 @@ MongoClient.connect(config.mongodb || process.env.CLOUDASH_MONGODB, function(err
4554
console.log('Installation finished.');
4655
console.log('Use credentials admin:admin at ' + config.url);
4756
});
48-
});
57+
});

0 commit comments

Comments
 (0)