🔨 Change config location

This commit is contained in:
Sebastien Clement 2020-01-10 21:29:49 +01:00
parent 92fbb5fd4a
commit c2d68232a5
5 changed files with 16 additions and 5 deletions

View File

@ -38,7 +38,9 @@ app.use(function(err, req, res, next) {
res.render('error'); res.render('error');
}); });
const fs = require('fs');
if (!fs.existsSync('/data'))
fs.mkdirSync('/data');
const statusTools = require('./tools/status'); const statusTools = require('./tools/status');
statusTools.init(); statusTools.init();
console.log("Satus : \x1b[32mGo !\x1b[0m") console.log("Satus : \x1b[32mGo !\x1b[0m")
@ -68,4 +70,6 @@ const cronTools = require('./tools/cronTools');
cronTools.startCron(); cronTools.startCron();
module.exports = app; module.exports = app;

View File

@ -53,6 +53,8 @@ router.get('/formated-backup-manual', function(req, res, next) {
return -1; return -1;
}) })
res.render('backupSnaps',{backups: contents, moment: moment}); res.render('backupSnaps',{backups: contents, moment: moment});
}).catch(()=>{
res.send();
}); });
}); });
@ -67,8 +69,9 @@ router.get('/formated-backup-auto', function(req, res, next) {
return -1; return -1;
}) })
res.render('backupSnaps',{backups: contents, moment: moment}); res.render('backupSnaps',{backups: contents, moment: moment});
}).catch(()=>{
res.send();
}); });
}); });

View File

@ -1,6 +1,6 @@
const fs = require('fs'); const fs = require('fs');
const settingsPath = "./backup_conf.json" const settingsPath = "/data/backup_conf.json"
function getSettings(){ function getSettings(){

View File

@ -1,6 +1,6 @@
const fs = require('fs'); const fs = require('fs');
const statusPath = './status.json' const statusPath = '/data/status.json'
let baseStatus = { let baseStatus = {
status: "idle", status: "idle",

View File

@ -4,7 +4,7 @@ const moment = require('moment');
const statusTools = require('./status'); const statusTools = require('./status');
const endpoint = "/remote.php/webdav" const endpoint = "/remote.php/webdav"
const configPath = "./webdav_conf.json" const configPath = "/data/webdav_conf.json"
const path = require('path'); const path = require('path');
const settingsTools = require('./settingsTools'); const settingsTools = require('./settingsTools');
const pathTools = require('./pathTools'); const pathTools = require('./pathTools');
@ -221,6 +221,10 @@ class WebdavTools {
getFolderContent(path) { getFolderContent(path) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(this.client == null){
reject();
return;
}
this.client.getDirectoryContents(path) this.client.getDirectoryContents(path)
.then((contents) => { .then((contents) => {
resolve(contents); resolve(contents);