Fix usage of default config
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import Consola from 'consola';
|
||||
import { BackendConfigType } from '../../types/config';
|
||||
import { BackendConfigType, ConfigType } from '../../types/config';
|
||||
import { backendMigrateConfig } from './backendMigrateConfig';
|
||||
import { configExists } from './configExists';
|
||||
import { getFallbackConfig } from './getFallbackConfig';
|
||||
import { readConfig } from './readConfig';
|
||||
|
||||
export const getConfig = (name: string): BackendConfigType => {
|
||||
if (!configExists(name)) return getFallbackConfig();
|
||||
if (!configExists(name)) return getFallbackConfig() as unknown as ConfigType;
|
||||
// Else if config exists but contains no "schema_version" property
|
||||
// then it is an old config file and we should try to migrate it
|
||||
// to the new format.
|
||||
|
||||
@@ -1,39 +1,8 @@
|
||||
import { BackendConfigType } from '../../types/config';
|
||||
import defaultConfig from '../../../data/configs/default.json';
|
||||
|
||||
export const getFallbackConfig = (name?: string): BackendConfigType => ({
|
||||
schemaVersion: 1,
|
||||
export const getFallbackConfig = (name?: string) => ({
|
||||
...defaultConfig,
|
||||
configProperties: {
|
||||
name: name ?? 'default',
|
||||
},
|
||||
categories: [],
|
||||
widgets: [],
|
||||
apps: [],
|
||||
settings: {
|
||||
common: {
|
||||
searchEngine: {
|
||||
type: 'google',
|
||||
properties: {
|
||||
enabled: true,
|
||||
openInNewTab: true,
|
||||
},
|
||||
},
|
||||
defaultConfig: 'default',
|
||||
},
|
||||
customization: {
|
||||
colors: {},
|
||||
layout: {
|
||||
enabledDocker: false,
|
||||
enabledLeftSidebar: false,
|
||||
enabledPing: false,
|
||||
enabledRightSidebar: false,
|
||||
enabledSearchbar: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
wrappers: [
|
||||
{
|
||||
id: 'default',
|
||||
position: 0,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user