Fixed install script (bis)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const refConfig = require('./default_config.json');
|
||||
const srcConfig = require('../config.json');
|
||||
|
||||
const merge = function (ref, src) {
|
||||
if (typeof ref !== typeof src) {
|
||||
return ref;
|
||||
} else if (typeof ref === 'object') {
|
||||
const out = {};
|
||||
Object.keys(ref).forEach(key => out[key] = merge(ref[key], src[key]));
|
||||
return out;
|
||||
} else {
|
||||
return src;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = merge(refConfig, srcConfig);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"nodePort": 3000,
|
||||
"dataDir": "data",
|
||||
"modules" : {
|
||||
"plantuml" : false,
|
||||
"rss": true,
|
||||
"webhook": true
|
||||
},
|
||||
"home" : {
|
||||
"index" : "index.ejs"
|
||||
},
|
||||
"article" : {
|
||||
"index" : "index.md"
|
||||
},
|
||||
"rss" : {
|
||||
"endpoint" : "/rss",
|
||||
"length" : 10
|
||||
},
|
||||
"webhook" : {
|
||||
"endpoint": "/webhook",
|
||||
"secretFile": "git_secret"
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const ncp = require('ncp').ncp;
|
||||
|
||||
const pad0 = n => ('0'+n).substr(-2);
|
||||
|
||||
const datetime = new Date();
|
||||
const dir = `./data/${datetime.getFullYear()}/${pad0(datetime.getMonth())}/${pad0(datetime.getDay())}/`;
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, {recursive: true});
|
||||
}
|
||||
|
||||
ncp('./sample_data/',dir, function(err){
|
||||
if(err)
|
||||
console.error(err);
|
||||
else
|
||||
console.log(`sample data copied to ${dir}`);
|
||||
});
|
||||
+3
-5
@@ -1,9 +1,7 @@
|
||||
const config = require('../config.json');
|
||||
const config = require('./config');
|
||||
const app = require('./app')(config);
|
||||
|
||||
const port = config.nodePort|3000;
|
||||
|
||||
app.listen(config.nodePort|3000, () => {
|
||||
console.log(`gitblog.md server listening on port ${port}`);
|
||||
app.listen(config.nodePort, () => {
|
||||
console.log(`gitblog.md server listening on port ${config.nodePort}`);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user