mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-18 03:01:09 +01:00
Fix usage of default config
This commit is contained in:
@@ -1,29 +1,14 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { getFallbackConfig } from './config/getFallbackConfig';
|
||||
import { ConfigType } from '../types/config';
|
||||
|
||||
export function getConfig(name: string, props: any = undefined) {
|
||||
// Check if the config file exists
|
||||
const configPath = path.join(process.cwd(), 'data/configs', `${name}.json`);
|
||||
if (!fs.existsSync(configPath)) {
|
||||
return {
|
||||
props: {
|
||||
configName: name,
|
||||
config: {
|
||||
name: name.toString(),
|
||||
services: [],
|
||||
settings: {
|
||||
searchUrl: 'https://www.google.com/search?q=',
|
||||
},
|
||||
modules: {
|
||||
'Search Bar': {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return getFallbackConfig() as unknown as ConfigType;
|
||||
}
|
||||
|
||||
const config = fs.readFileSync(configPath, 'utf8');
|
||||
// Print loaded config
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user