Skip to content

Commit 6c258d7

Browse files
author
Mark Moffat
committedMar 3, 2016
[Fix mrvautin#47] - Create /config dir and files if they don't exist.
1 parent 566317d commit 6c258d7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

‎app.js

+12
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,19 @@ app.use("/bootstrap", express.static(path.join(__dirname, 'node_modules/bootstra
5959
app.use(express.static(path.join(__dirname, 'public')));
6060

6161
// setup nconf to read in the file
62+
63+
// create config dir and blank files if they dont exist
6264
var fs = require('fs');
65+
if (!fs.existsSync("config")){
66+
fs.mkdirSync("config");
67+
}
68+
if (!fs.existsSync("config/config.json")){
69+
fs.writeFileSync("config/config.json", "{}");
70+
}
71+
if (!fs.existsSync("config/app.json")){
72+
fs.writeFileSync("config/app.json", "{}");
73+
}
74+
6375
var connection_config = path.join(__dirname, 'config', 'config.json');
6476
var app_config = path.join(__dirname, 'config', 'app.json');
6577

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "admin-mongo",
3-
"version": "0.0.1",
3+
"version": "0.0.3",
44
"description": "A Web user interface to administer MongoDB databases",
55
"author": "Mark Moffat <mrvautin@gmail.com>",
66
"private": false,

0 commit comments

Comments
 (0)