update savefile location
This commit is contained in:
parent
4f2948d0f0
commit
01c24d7eec
|
@ -19,12 +19,13 @@ var readFileAsync = util.promisify(fs.readFile);
|
||||||
var mkdirpAsync = util.promisify(require('mkdirp'));
|
var mkdirpAsync = util.promisify(require('mkdirp'));
|
||||||
var TRUSTED_ISSUERS = [ 'oauth3.org' ];
|
var TRUSTED_ISSUERS = [ 'oauth3.org' ];
|
||||||
var DB = {};
|
var DB = {};
|
||||||
|
DB._savefile = path.join(__dirname, 'permissions.json');
|
||||||
DB._load = function () {
|
DB._load = function () {
|
||||||
try {
|
try {
|
||||||
DB._perms = require('./permissions.json');
|
DB._perms = require(DB._savefile);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
try {
|
try {
|
||||||
DB._perms = require('./permissions.json.bak');
|
DB._perms = require(DB._savefile + '.bak');
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
DB._perms = [];
|
DB._perms = [];
|
||||||
}
|
}
|
||||||
|
@ -188,7 +189,7 @@ DB.ports._add = function (acc, number) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
DB._save = function () {
|
DB._save = function () {
|
||||||
return sfs.writeFileAsync('./accounts.json', JSON.stringify(DB._perms));
|
return sfs.writeFileAsync(DB._savefile, JSON.stringify(DB._perms));
|
||||||
};
|
};
|
||||||
DB._saveToken = null;
|
DB._saveToken = null;
|
||||||
DB._savePromises = [];
|
DB._savePromises = [];
|
||||||
|
|
Loading…
Reference in New Issue