mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
💄 Styling backgrounds of widgets
This commit is contained in:
31
src/tools/getConfig.ts
Normal file
31
src/tools/getConfig.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
export function getConfig(name: string) {
|
||||
// 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: {},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const config = fs.readFileSync(configPath, 'utf8');
|
||||
// Print loaded config
|
||||
return {
|
||||
props: {
|
||||
configName: name,
|
||||
config: JSON.parse(config),
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user