mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
fixing default configs
This commit is contained in:
@@ -1,9 +1,4 @@
|
|||||||
export const DEFAULT_CONFIG = {
|
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.
|
// Default path for sqlite storage directory. Interpreted relative to project root.
|
||||||
sqlitepath: '/db',
|
sqlitepath: '/db',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import logger from '../../../logger.js';
|
import logger from '../../../logger.js';
|
||||||
|
import { DEFAULT_CONFIG } from '../../../../defaultConfig.js';
|
||||||
|
import { getDirName } from '../../../../utils.js';
|
||||||
|
|
||||||
export function up(db) {
|
export function up(db) {
|
||||||
db.exec(`
|
db.exec(`
|
||||||
@@ -67,6 +69,10 @@ export function up(db) {
|
|||||||
'analyticsEnabled',
|
'analyticsEnabled',
|
||||||
config.analyticsEnabled != null ? config.analyticsEnabled : defaults.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) {
|
} catch (e) {
|
||||||
logger.error(e);
|
logger.error(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ function compileSettings(rows, configValues) {
|
|||||||
config[r.name] = parsed && typeof parsed === 'object' && 'value' in parsed ? parsed.value : parsed;
|
config[r.name] = parsed && typeof parsed === 'object' && 'value' in parsed ? parsed.value : parsed;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...config,
|
|
||||||
...configValues,
|
...configValues,
|
||||||
|
...config,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "fredy",
|
"name": "fredy",
|
||||||
"version": "15.0.1",
|
"version": "15.1.0",
|
||||||
"description": "[F]ind [R]eal [E]states [d]amn eas[y].",
|
"description": "[F]ind [R]eal [E]states [d]amn eas[y].",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
|
|||||||
Reference in New Issue
Block a user