mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 18:40:34 -05:00
36 lines
813 B
JavaScript
36 lines
813 B
JavaScript
let config = {};
|
|
let fs = require('fs');
|
|
let { join } = require('path');
|
|
let root = fs.existsSync('/data') ? '/data' : __dirname;
|
|
|
|
try {
|
|
// @ts-expect-error TS2307: we expect this file may not exist
|
|
config = require('./config');
|
|
} catch (e) {
|
|
// do nothing
|
|
}
|
|
|
|
if (process.env.NODE_ENV === 'test') {
|
|
config = {
|
|
mode: 'test',
|
|
port: 5006,
|
|
hostname: '::',
|
|
serverFiles: join(__dirname, 'test-server-files'),
|
|
userFiles: join(__dirname, 'test-user-files')
|
|
};
|
|
} else {
|
|
config = {
|
|
mode: 'development',
|
|
port: 5006,
|
|
hostname: '::',
|
|
serverFiles: join(root, 'server-files'),
|
|
userFiles: join(root, 'user-files'),
|
|
...config
|
|
};
|
|
}
|
|
|
|
// The env variable always takes precedence
|
|
config.userFiles = process.env.ACTUAL_USER_FILES || config.userFiles;
|
|
|
|
module.exports = config;
|