Respect configuration for user-files
This commit is contained in:
parent
3c602268e3
commit
8aeb815b5a
3 changed files with 7 additions and 12 deletions
13
app-sync.js
13
app-sync.js
|
@ -16,17 +16,8 @@ let SyncPb = actual.internal.SyncProtoBuf;
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(errorMiddleware);
|
app.use(errorMiddleware);
|
||||||
|
|
||||||
async function init() {
|
// eslint-disable-next-line
|
||||||
let fileDir = join(process.env.ACTUAL_USER_FILES || config.userFiles);
|
async function init() {}
|
||||||
|
|
||||||
console.log('Initializing Actual with user file dir:', fileDir);
|
|
||||||
|
|
||||||
await actual.init({
|
|
||||||
config: {
|
|
||||||
dataDir: fileDir
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is a version representing the internal format of sync
|
// This is a version representing the internal format of sync
|
||||||
// messages. When this changes, all sync files need to be reset. We
|
// messages. When this changes, all sync files need to be reset. We
|
||||||
|
|
|
@ -16,4 +16,7 @@ try {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The env variable always takes precedence
|
||||||
|
config.userFiles = process.env.ACTUAL_USER_FILES || config.userFiles;
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
let { existsSync, readFileSync } = require('fs');
|
let { existsSync, readFileSync } = require('fs');
|
||||||
let { join } = require('path');
|
let { join } = require('path');
|
||||||
let { openDatabase } = require('./db');
|
let { openDatabase } = require('./db');
|
||||||
|
let config = require('./load-config');
|
||||||
|
|
||||||
let actual = require('@actual-app/api');
|
let actual = require('@actual-app/api');
|
||||||
let merkle = actual.internal.merkle;
|
let merkle = actual.internal.merkle;
|
||||||
|
@ -8,7 +9,7 @@ let SyncPb = actual.internal.SyncProtoBuf;
|
||||||
let Timestamp = actual.internal.timestamp.default;
|
let Timestamp = actual.internal.timestamp.default;
|
||||||
|
|
||||||
function getGroupDb(groupId) {
|
function getGroupDb(groupId) {
|
||||||
let path = join(__dirname, `user-files/${groupId}.sqlite`);
|
let path = join(config.userFiles, `${groupId}.sqlite`);
|
||||||
let needsInit = !existsSync(path);
|
let needsInit = !existsSync(path);
|
||||||
|
|
||||||
let db = openDatabase(path);
|
let db = openDatabase(path);
|
||||||
|
|
Loading…
Reference in a new issue