fixing default configs

This commit is contained in:
orangecoding
2025-12-10 09:24:44 +01:00
parent 1e2476a375
commit cef9b5c8fc
4 changed files with 8 additions and 7 deletions

View File

@@ -1,9 +1,4 @@
export const DEFAULT_CONFIG = {
interval: '60',
port: 9998,
workingHours: { from: '', to: '' },
demoMode: false,
analyticsEnabled: true,
// Default path for sqlite storage directory. Interpreted relative to project root.
sqlitepath: '/db',
};

View File

@@ -3,6 +3,8 @@ import fs from 'fs';
import path from 'path';
import { nanoid } from 'nanoid';
import logger from '../../../logger.js';
import { DEFAULT_CONFIG } from '../../../../defaultConfig.js';
import { getDirName } from '../../../../utils.js';
export function up(db) {
db.exec(`
@@ -67,6 +69,10 @@ export function up(db) {
'analyticsEnabled',
config.analyticsEnabled != null ? config.analyticsEnabled : defaults.analyticsEnabled,
);
//now making sure only sqlite path remains in the config
const sqlitepath = config.sqlitepath || DEFAULT_CONFIG.sqlitepath;
fs.writeFileSync(`${getDirName()}/../conf/config.json`, JSON.stringify({ sqlitepath }));
} catch (e) {
logger.error(e);
}

View File

@@ -22,8 +22,8 @@ function compileSettings(rows, configValues) {
config[r.name] = parsed && typeof parsed === 'object' && 'value' in parsed ? parsed.value : parsed;
}
return {
...config,
...configValues,
...config,
};
}

View File

@@ -1,6 +1,6 @@
{
"name": "fredy",
"version": "15.0.1",
"version": "15.1.0",
"description": "[F]ind [R]eal [E]states [d]amn eas[y].",
"scripts": {
"prepare": "husky",