🔨 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');
});
const fs = require('fs');
if (!fs.existsSync('/data'))
fs.mkdirSync('/data');
const statusTools = require('./tools/status');
statusTools.init();
console.log("Satus : \x1b[32mGo !\x1b[0m")
@ -68,4 +70,6 @@ const cronTools = require('./tools/cronTools');
cronTools.startCron();
module.exports = app;

View File

@ -53,6 +53,8 @@ router.get('/formated-backup-manual', function(req, res, next) {
return -1;
})
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;
})
res.render('backupSnaps',{backups: contents, moment: moment});
}).catch(()=>{
res.send();
});
});

View File

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

View File

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

View File

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